{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "EWO4gOLNqljA"
      },
      "source": [
        "##### Copyright 2020 Google LLC.\n",
        "\n",
        "\n",
        "Licensed under the Apache License, Version 2.0 (the \"License\");\n",
        "you may not use this file except in compliance with the License.\n",
        "You may obtain a copy of the License at\n",
        "\n",
        "    https://www.apache.org/licenses/LICENSE-2.0\n",
        "\n",
        "Unless required by applicable law or agreed to in writing, software\n",
        "distributed under the License is distributed on an \"AS IS\" BASIS,\n",
        "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
        "See the License for the specific language governing permissions and\n",
        "limitations under the License."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "E4ZG6GsHqFga"
      },
      "source": [
        "# Figure 3 and Tables\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "K1OeUtmbTbjj"
      },
      "source": [
        "## Setup"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "mMu_u1jfWYye"
      },
      "outputs": [],
      "source": [
        "import os\n",
        "import zipfile\n",
        "\n",
        "from IPython.display import display\n",
        "from matplotlib import pyplot\n",
        "import numpy\n",
        "import pandas\n",
        "import scipy.spatial.distance as distance\n",
        "import scipy.stats\n",
        "import seaborn\n",
        "\n",
        "\n",
        "# The canonical single-letter code residue alphabet.\n",
        "RESIDUES = tuple('ACDEFGHIKLMNPQRSTVWY')\n",
        "\n",
        "# Residues sorted by physicochemical properties.\n",
        "#\n",
        "# This ordering is useful when generating visualizations to highlight common\n",
        "# behaviors among similar residues.\n",
        "RESIDUES_PHYSCHEM_ORDER = tuple('ILAVGMFYWEDQNHCRKSTP')\n",
        "\n",
        "# The full VP1 sequence for AAV serotype 2.\n",
        "AAV2_VP1_SEQ = 'MAADGYLPDWLEDTLSEGIRQWWKLKPGPPPPKPAERHKDDSRGLVLPGYKYLGPFNGLDKGEPVNEADAAALEHDKAYDRQLDSGDNPYLKYNHADAEFQERLKEDTSFGGNLGRAVFQAKKRVLEPLGLVEEPVKTAPGKKRPVEHSPVEPDSSSGTGKAGQQPARKRLNFGQTGDADSVPDPQPLGQPPAAPSGLGTNTMATGSGAPMADNNEGADGVGNSSGNWHCDSTWMGDRVITTSTRTWALPTYNNHLYKQISSQSGASNDNHYFGYSTPWGYFDFNRFHCHFSPRDWQRLINNNWGFRPKRLNFKLFNIQVKEVTQNDGTTTIANNLTSTVQVFTDSEYQLPYVLGSAHQGCLPPFPADVFMVPQYGYLTLNNGSQAVGRSSFYCLEYFPSQMLRTGNNFTFSYTFEDVPFHSSYAHSQSLDRLMNPLIDQYLYYLSRTNTPSGTTTQSRLQFSQAGASDIRDQSRNWLPGPCYRQQRVSKTSADNNNSEYSWTGATKYHLNGRDSLVNPGPAMASHKDDEEKFFPQSGVLIFGKQGSEKTNVDIEKVMITDEEEIRTTNPVATEQYGSVSTNLQRGNRQAATADVNTQGVLPGMVWQDRDVYLQGPIWAKIPHTDGHFHPSPLMGGFGLKHPPPQILIKNTPVPANPSTTFSAAKFASFITQYSTGQVSVEIEWELQKENSKRWNPEIQYTSNYNKSVNVDFTVDTNGVYSEPRPIGTRYLTRNL'\n",
        "\n",
        "# The AAV serotype 2 wild type subsequence corresponding to tile #21 in round #1\n",
        "# of experimental results.\n",
        "R1_TILE21_WT_SEQ = 'DEEEIRTTNPVATEQYGSVSTNLQRGNR'\n",
        "\n",
        "# The start and end residue numbers (inclusive) for the tile 21 wild type seq.\n",
        "#\n",
        "# Residue numbering scheme corresponds to the 1-based index of the AAV2 VP1\n",
        "# sequence.\n",
        "R1_TILE21_WT_START_RESNUM = 561\n",
        "R1_TILE21_WT_END_RESNUM = 588\n",
        "\n",
        "\n",
        "seed_display_name = 'model-selected'\n",
        "walked_display_name = 'model-designed'\n",
        "\n",
        "partition_pretty_names = {\n",
        "    'cnn_designed_plus_rand_train_seed': 'CNN-C ' + seed_display_name,\n",
        "    'cnn_designed_plus_rand_train_walked': 'CNN-C ' + walked_display_name,\n",
        "    'cnn_rand_doubles_plus_single_seed': 'CNN-A ' + seed_display_name,\n",
        "    'cnn_rand_doubles_plus_single_walked': 'CNN-A ' + walked_display_name,\n",
        "    'cnn_standard_seed': 'CNN-B ' + seed_display_name,\n",
        "    'cnn_standard_walked': 'CNN-B ' + walked_display_name,\n",
        "    'designed': 'Additive',\n",
        "    'lr_designed_plus_rand_train_seed': 'LR-C ' + seed_display_name,\n",
        "    'lr_designed_plus_rand_train_walked': 'LR-C ' + walked_display_name,\n",
        "    'lr_rand_doubles_plus_single_seed': 'LR-A ' + seed_display_name,\n",
        "    'lr_rand_doubles_plus_single_walked': 'LR-A ' + walked_display_name,\n",
        "    'lr_standard_seed': 'LR-B ' + seed_display_name,\n",
        "    'lr_standard_walked': 'LR-B ' + walked_display_name,\n",
        "    'rand': 'Random',\n",
        "    'rnn_designed_plus_rand_train_seed': 'RNN-C ' + seed_display_name,\n",
        "    'rnn_designed_plus_rand_train_walked': 'RNN-C ' + walked_display_name,\n",
        "    'rnn_rand_doubles_plus_singles_seed': 'RNN-A ' + seed_display_name,\n",
        "    'rnn_rand_doubles_plus_singles_walked': 'RNN-A ' + walked_display_name,\n",
        "    'rnn_standard_seed': 'RNN-B ' + seed_display_name,\n",
        "    'rnn_standard_walked': 'RNN-B ' + walked_display_name,\n",
        "}\n",
        "\n",
        "ml_generated_partitions = [\n",
        "    'rnn_designed_plus_rand_train_walked',\n",
        "    'rnn_designed_plus_rand_train_seed',\n",
        "    'rnn_rand_doubles_plus_singles_walked',\n",
        "    'rnn_rand_doubles_plus_singles_seed',\n",
        "    'rnn_standard_walked',\n",
        "    'rnn_standard_seed',\n",
        "    'cnn_designed_plus_rand_train_walked',\n",
        "    'cnn_designed_plus_rand_train_seed',\n",
        "    'cnn_rand_doubles_plus_single_walked',\n",
        "    'cnn_rand_doubles_plus_single_seed',\n",
        "    'cnn_standard_walked',\n",
        "    'cnn_standard_seed',\n",
        "    'lr_designed_plus_rand_train_walked',\n",
        "    'lr_designed_plus_rand_train_seed',\n",
        "    'lr_rand_doubles_plus_single_walked',\n",
        "    'lr_rand_doubles_plus_single_seed',\n",
        "    'lr_standard_walked',\n",
        "    'lr_standard_seed',\n",
        "]\n",
        "\n",
        "ml_designed_partitions = [\n",
        "    'lr_rand_doubles_plus_single_walked',\n",
        "    'lr_standard_walked',\n",
        "    'lr_designed_plus_rand_train_walked',\n",
        "\n",
        "    'cnn_rand_doubles_plus_single_walked',\n",
        "    'cnn_standard_walked',\n",
        "    'cnn_designed_plus_rand_train_walked',\n",
        "\n",
        "    'rnn_rand_doubles_plus_singles_walked',\n",
        "    'rnn_standard_walked',\n",
        "    'rnn_designed_plus_rand_train_walked',\n",
        "]\n",
        "\n",
        "nn_designed_partitions = [\n",
        "    'cnn_rand_doubles_plus_single_walked',\n",
        "    'cnn_standard_walked',\n",
        "    'cnn_designed_plus_rand_train_walked',\n",
        "\n",
        "    'rnn_rand_doubles_plus_singles_walked',\n",
        "    'rnn_standard_walked',\n",
        "    'rnn_designed_plus_rand_train_walked',\n",
        "]\n",
        "\n",
        "ml_selected_partitions = [\n",
        "    'lr_rand_doubles_plus_single_seed',\n",
        "    'lr_standard_seed',\n",
        "    'lr_designed_plus_rand_train_seed',\n",
        "    \n",
        "    'cnn_rand_doubles_plus_single_seed',\n",
        "    'cnn_standard_seed',\n",
        "    'cnn_designed_plus_rand_train_seed',\n",
        "\n",
        "    'rnn_rand_doubles_plus_singles_seed',\n",
        "    'rnn_standard_seed',\n",
        "    'rnn_designed_plus_rand_train_seed',    \n",
        "]\n",
        "\n",
        "ml_designed_partitions_doubles = [\n",
        "    'lr_rand_doubles_plus_single_walked',\n",
        "    'cnn_rand_doubles_plus_single_walked',\n",
        "    'rnn_rand_doubles_plus_singles_walked',\n",
        "]\n",
        "\n",
        "ml_designed_partitions_standard = [\n",
        "    'lr_standard_walked',\n",
        "    'cnn_standard_walked',\n",
        "    'rnn_standard_walked',\n",
        "]\n",
        "\n",
        "ml_designed_partitions_designed = [\n",
        "    'lr_designed_plus_rand_train_walked',\n",
        "    'cnn_designed_plus_rand_train_walked',\n",
        "    'rnn_designed_plus_rand_train_walked',\n",
        "]\n",
        "\n",
        "baseline_random_partitions = ['rand']\n",
        "\n",
        "baseline_additive_partitions = ['designed']"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "LqSIx7AkgayM"
      },
      "outputs": [],
      "source": [
        "# Sentinel token value for denoting \"no mutation here\".\n",
        "_PLACEHOLDER_TOKEN = '_'\n",
        "# Number of different mutation slots to use for each wildtype sequence position.\n",
        "_NUM_MUTATION_SLOTS = 2  # 1 substitution + 1 insert possible per wt position.\n",
        "# Slot index for substitution mutations.\n",
        "_SUB_INDEX = 0\n",
        "# Slot index for insertion mutations.\n",
        "_INS_INDEX = 1\n",
        "\n",
        "\n",
        "def tokenize_mutation_seq(seq, placeholder_token='_'):\n",
        "  \"\"\"Converts a variable-length mutation sequence to a fixed-length sequence.\n",
        "\n",
        "  For an N-residue reference sequence, the encoding is shape (N+1, M, A), where\n",
        "  A is the alphabet size (e.g., A=20 for the canonical peptide alphabet) and M\n",
        "  is the number of distinct mutation types at each position; here, M=2\n",
        "  (1x sub + 1x ins at each reference sequence position).\n",
        "\n",
        "  Args:\n",
        "    seq: (str) A mutation sequence to tokenize; e.g., \"__A_\" or \"aTEST\".\n",
        "    placeholder_token: (str) Sentinel value used to encode non-mutated positions\n",
        "      in the mutation sequence.\n",
        "  Returns:\n",
        "    A length-N+1 sequence of (\"\u003csubstitution_token\u003e\", \"\u003cinsertion token\u003e\")\n",
        "    2-tuples.\n",
        "  \"\"\"\n",
        "  tokens = []\n",
        "  i = 0\n",
        "  # Consume the prefix insertion mutation if there is one.\n",
        "  #\n",
        "  # A prefix insertion is denoted by a leading lower case letter on the seq.\n",
        "  if seq[i].islower():\n",
        "    tokens.append((placeholder_token, seq[i].upper()))\n",
        "    i += 1\n",
        "  else:\n",
        "    tokens.append((placeholder_token, placeholder_token))\n",
        "\n",
        "  while i \u003c len(seq):\n",
        "    if i \u003c len(seq) - 1 and seq[i + 1].islower():\n",
        "      tokens.append((seq[i], seq[i+1].upper()))\n",
        "      i += 2\n",
        "    else:\n",
        "      tokens.append((seq[i], placeholder_token))\n",
        "      i += 1\n",
        "  return tokens\n",
        "\n",
        "\n",
        "class MutationSequenceEncoder(object):\n",
        "  \"\"\"Mutation sequence encoder for generating fixed-length representations.\n",
        "\n",
        "  The encoding has two slots for each residue position in the ref sequence:\n",
        "    1. A slot that encodes a residue substitution mutation\n",
        "    2. A slot that encodes a single-residue insertion mutation\n",
        "\n",
        "  There is also a pair of slots for any single-position prefix mutation.\n",
        "\n",
        "  Attributes:\n",
        "    encoding_size: (int) The encoding length for a single residue.\n",
        "  \"\"\"\n",
        "\n",
        "  def __init__(self, residue_encoder, ref_seq):\n",
        "    \"\"\"Constructor.\n",
        "\n",
        "    Args:\n",
        "      residue_encoder: (object) A single residue encoder\n",
        "      ref_seq: (str) The reference (non-mutated) sequence.\n",
        "    \"\"\"\n",
        "    self._residue_encoder = residue_encoder\n",
        "    self._ref_seq = ref_seq\n",
        "    self.encoding_size = self._residue_encoder.encoding_size\n",
        "\n",
        "  def encode(self, seq):\n",
        "    \"\"\"Encodes a mutation sequence as a fixed-length multi-dimensional array.\n",
        "\n",
        "    Args:\n",
        "      seq: (str) A mutation sequence to encode; e.g., \"__A_\".\n",
        "    Returns:\n",
        "      A numpy.ndarray(shape=(len(ref_seq)+1, 2, encoding_size), dtype=float).\n",
        "    Raises:\n",
        "      ValueError: if the mutation sequence references a different number of\n",
        "        sequence positions than the specified ref_seq.\n",
        "    \"\"\"\n",
        "    seq_encoding = numpy.zeros((\n",
        "        len(self._ref_seq) + 1,\n",
        "        _NUM_MUTATION_SLOTS,\n",
        "        self.encoding_size))\n",
        "\n",
        "    sub_ins_tokens = tokenize_mutation_seq(seq, _PLACEHOLDER_TOKEN)\n",
        "    if len(sub_ins_tokens) != len(self._ref_seq) + 1:\n",
        "      raise ValueError('Mutation sequence dimension mismatch: '\n",
        "                       '%d mutation positions vs %d in reference sequence'\n",
        "                       % (len(sub_ins_tokens), len(self._ref_seq) + 1))\n",
        "\n",
        "    for position_i, (sub_token, ins_token) in enumerate(sub_ins_tokens):\n",
        "      if sub_token != _PLACEHOLDER_TOKEN:\n",
        "        seq_encoding[position_i, _SUB_INDEX, :] = self._residue_encoder.encode(\n",
        "            sub_token)\n",
        "      if ins_token != _PLACEHOLDER_TOKEN:\n",
        "        seq_encoding[position_i, _INS_INDEX, :] = self._residue_encoder.encode(\n",
        "            ins_token)\n",
        "    return seq_encoding\n",
        "\n",
        "\n",
        "class ResidueIdentityEncoder(object):\n",
        "  \"\"\"Residue identity encoder, either one-hot or residue index.\n",
        "\n",
        "  Attributes:\n",
        "    encoding_size: (int) The number of encoding dimensions for a single residue.\n",
        "  \"\"\"\n",
        "\n",
        "  def __init__(self, alphabet, one_hot=True):\n",
        "    \"\"\"Constructor.\n",
        "\n",
        "    Args:\n",
        "      alphabet: (seq\u003cchar\u003e) The alphabet of valid tokens for the sequence;\n",
        "        e.g., the 20x 1-letter residue codes for standard peptides.\n",
        "      one_hot: if true, performs one-hot encoding (dim = alphabet length);\n",
        "        if false, encodes as the index of the residue in the alphabet (dim = 1).\n",
        "    \"\"\"\n",
        "    self._alphabet = [l.upper() for l in alphabet]\n",
        "    self._letter_to_id = dict((letter, id) for (id, letter)\n",
        "                              in enumerate(self._alphabet))\n",
        "    self._one_hot = one_hot\n",
        "    self.encoding_size = len(self._alphabet) if one_hot else 1\n",
        "\n",
        "  def encode(self, residue):\n",
        "    \"\"\"Encodes a single residue as a one hot identity vector.\n",
        "\n",
        "    Args:\n",
        "      residue: (str) A single-character string representing one residue; e.g.,\n",
        "        'A' for Alanine.\n",
        "    Returns:\n",
        "      If one-hot=True, a numpy.ndarray(shape=(A,), dtype=float) with a single\n",
        "      non-zero (1) value; the identity index for each residue in the alphabet is\n",
        "      given by the residue's index in the alphabet ordered sequence; i.e., for\n",
        "      the alphabet 'ACDE', a 'C' would be encoded as [0, 1, 0, 0].\n",
        "      If one-hot=False, a numpy.ndarray(shape=(1,), dtype=float) with the\n",
        "      residue's index in the alphabet ordered sequence.\n",
        "    \"\"\"\n",
        "    if self._one_hot:\n",
        "      onehot = numpy.zeros(self.encoding_size, dtype=float)\n",
        "      onehot[self._letter_to_id[residue]] = 1\n",
        "      return onehot\n",
        "    else:\n",
        "      return numpy.array((self._letter_to_id[residue],), dtype=float)\n",
        "\n",
        "\n",
        "ONEHOT_FIXEDLEN_MUTATION_ENCODER = MutationSequenceEncoder(\n",
        "    ResidueIdentityEncoder(RESIDUES), R1_TILE21_WT_SEQ)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "obAWgZ0EfxKP"
      },
      "source": [
        "### Load data"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 241
        },
        "executionInfo": {
          "elapsed": 5717,
          "status": "ok",
          "timestamp": 1587396720904,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "rn7q4nUb1PmD",
        "outputId": "238fe07a-ac09-4915-aa8a-ef7e6a8c724f"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "(296970, 6)\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003esequence\u003c/th\u003e\n",
              "      \u003cth\u003epartition\u003c/th\u003e\n",
              "      \u003cth\u003emutation_sequence\u003c/th\u003e\n",
              "      \u003cth\u003enum_edits\u003c/th\u003e\n",
              "      \u003cth\u003eviral_selection\u003c/th\u003e\n",
              "      \u003cth\u003eis_viable\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003eADEEIRATNPIATEMYGSVSTNLQLGNR\u003c/td\u003e\n",
              "      \u003ctd\u003edesigned\u003c/td\u003e\n",
              "      \u003ctd\u003eAD____A___I___M_________L___\u003c/td\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e-2.027259\u003c/td\u003e\n",
              "      \u003ctd\u003eFalse\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003eADEEIRATNPVATEQYGSVSTNQQRQNR\u003c/td\u003e\n",
              "      \u003ctd\u003edesigned\u003c/td\u003e\n",
              "      \u003ctd\u003eAD____A_______________Q__Q__\u003c/td\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e-0.429554\u003c/td\u003e\n",
              "      \u003ctd\u003eTrue\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003eADEEIRTTNPVATEQWGGVSTNLQIGNY\u003c/td\u003e\n",
              "      \u003ctd\u003edesigned\u003c/td\u003e\n",
              "      \u003ctd\u003eAD_____________W_G______I__Y\u003c/td\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e-0.527843\u003c/td\u003e\n",
              "      \u003ctd\u003eTrue\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003eADEEIRTTNPVATEQYGEVSTNLQRGNR\u003c/td\u003e\n",
              "      \u003ctd\u003edesigned\u003c/td\u003e\n",
              "      \u003ctd\u003eAD_______________E__________\u003c/td\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e2.887908\u003c/td\u003e\n",
              "      \u003ctd\u003eTrue\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003eADEEIRTTNPVATEQYGSVSTNLQRGNR\u003c/td\u003e\n",
              "      \u003ctd\u003edesigned\u003c/td\u003e\n",
              "      \u003ctd\u003eAD__________________________\u003c/td\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e0.575730\u003c/td\u003e\n",
              "      \u003ctd\u003eTrue\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "                       sequence partition             mutation_sequence  \\\n",
              "0  ADEEIRATNPIATEMYGSVSTNLQLGNR  designed  AD____A___I___M_________L___   \n",
              "1  ADEEIRATNPVATEQYGSVSTNQQRQNR  designed  AD____A_______________Q__Q__   \n",
              "2  ADEEIRTTNPVATEQWGGVSTNLQIGNY  designed  AD_____________W_G______I__Y   \n",
              "3  ADEEIRTTNPVATEQYGEVSTNLQRGNR  designed  AD_______________E__________   \n",
              "4  ADEEIRTTNPVATEQYGSVSTNLQRGNR  designed  AD__________________________   \n",
              "\n",
              "   num_edits  viral_selection  is_viable  \n",
              "0          6        -2.027259      False  \n",
              "1          5        -0.429554       True  \n",
              "2          6        -0.527843       True  \n",
              "3          3         2.887908       True  \n",
              "4          2         0.575730       True  "
            ]
          },
          "execution_count": 3,
          "metadata": {
            "tags": []
          },
          "output_type": "execute_result"
        }
      ],
      "source": [
        "my_zip = zipfile.ZipFile('allseqs_20191230.csv.zip')\n",
        "my_zip.extractall() # extract csv file to the current working directory\n",
        "\n",
        "df = pandas.read_csv('allseqs_20191230.csv', index_col=None)\n",
        "del df['num_mutations']  # Prefer 'num_edits' column which is Levenshtein distance to WT\n",
        "\n",
        "print df.shape\n",
        "df.head()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "kU97kJZSIaVN"
      },
      "source": [
        "## SI Tables: generated and viable capsid statistics"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "cKXYke5aIgZV"
      },
      "source": [
        "#### Lib"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "1RVTTfKR9jOv"
      },
      "outputs": [],
      "source": [
        "def _get_percent_viable(num_viable, num_total):\n",
        "  if num_total == 0:\n",
        "    return 0\n",
        "  else: \n",
        "    return float(num_viable) / num_total * 100\n",
        "\n",
        "\n",
        "def _format_stats_table(stats_table):\n",
        "  percent_formatter = lambda pct: '{:4.1f}%'.format(pct)\n",
        "  count_formatter = lambda n: '{:7,}'.format(n)\n",
        "\n",
        "  stats_table['percent_viable'] = stats_table.percent_viable.apply(percent_formatter)\n",
        "  stats_table['num_total'] = stats_table.num_total.apply(count_formatter)\n",
        "  stats_table['num_viable'] = stats_table.num_viable.apply(count_formatter)\n",
        "\n",
        "  return stats_table.rename({\n",
        "    'num_total': '# generated', \n",
        "    'num_viable': '# viable',\n",
        "    'percent_viable': '% viable',\n",
        "  }, axis=1)\n",
        "\n",
        "\n",
        "def performance_by_wt_distance(df, partitions, distances=range(2, 30)):\n",
        "  rows = []\n",
        "  for t in distances:\n",
        "    num_viable = len(df[\n",
        "        df.partition.isin(partitions) \n",
        "        \u0026 (df.num_edits \u003e= t)\n",
        "        \u0026 df.is_viable\n",
        "    ])\n",
        "    num_total = len(df[\n",
        "        df.partition.isin(partitions) \n",
        "        \u0026 (df.num_edits \u003e= t)\n",
        "    ])\n",
        "\n",
        "    rows.append({\n",
        "        'min_mutations': t,\n",
        "        'num_total': num_total, \n",
        "        'num_viable': num_viable,\n",
        "        'percent_viable': _get_percent_viable(num_viable, num_total),\n",
        "    })\n",
        "  col_order = [\n",
        "    'min_mutations',\n",
        "    'num_total',\n",
        "    'num_viable',\n",
        "    'percent_viable',\n",
        "  ]    \n",
        "  return _format_stats_table(pandas.DataFrame(rows, columns=col_order))\n",
        "\n",
        "\n",
        "def performance_by_model(df, partitions):\n",
        "  rows = []\n",
        "  for partition in partitions:\n",
        "    num_viable = len(df[(df.partition == partition) \u0026 df.is_viable])\n",
        "    num_total = len(df[df.partition == partition])\n",
        "\n",
        "    rows.append({\n",
        "        'partition': partition,\n",
        "        'num_total': num_total, \n",
        "        'num_viable': num_viable, \n",
        "        'percent_viable': _get_percent_viable(num_viable, num_total),\n",
        "    })\n",
        "\n",
        "  col_order = [\n",
        "    'partition',\n",
        "    'num_total',\n",
        "    'num_viable',\n",
        "    'percent_viable',\n",
        "  ]\n",
        "  return _format_stats_table(pandas.DataFrame(rows, columns=col_order))\n",
        "\n",
        "\n",
        "# display(performance_by_wt_distance(df, ml_designed_partitions))\n",
        "# display(performance_by_model(df, ml_designed_partitions))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "eu0gJiKBInn5"
      },
      "source": [
        "#### SI Table 1"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 917
        },
        "executionInfo": {
          "elapsed": 4561,
          "status": "ok",
          "timestamp": 1587666823814,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "pl32qMy7IpH4",
        "outputId": "0540ced1-5c5a-47a3-d6db-306d4ccf646d"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003emin_mutations\u003c/th\u003e\n",
              "      \u003cth\u003e# generated\u003c/th\u003e\n",
              "      \u003cth\u003e# viable\u003c/th\u003e\n",
              "      \u003cth\u003e% viable\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e201,426\u003c/td\u003e\n",
              "      \u003ctd\u003e110,689\u003c/td\u003e\n",
              "      \u003ctd\u003e55.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e201,426\u003c/td\u003e\n",
              "      \u003ctd\u003e110,689\u003c/td\u003e\n",
              "      \u003ctd\u003e55.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e201,424\u003c/td\u003e\n",
              "      \u003ctd\u003e110,687\u003c/td\u003e\n",
              "      \u003ctd\u003e55.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e201,368\u003c/td\u003e\n",
              "      \u003ctd\u003e110,633\u003c/td\u003e\n",
              "      \u003ctd\u003e54.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e193,413\u003c/td\u003e\n",
              "      \u003ctd\u003e103,403\u003c/td\u003e\n",
              "      \u003ctd\u003e53.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003e7\u003c/td\u003e\n",
              "      \u003ctd\u003e184,424\u003c/td\u003e\n",
              "      \u003ctd\u003e95,422\u003c/td\u003e\n",
              "      \u003ctd\u003e51.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003e8\u003c/td\u003e\n",
              "      \u003ctd\u003e175,443\u003c/td\u003e\n",
              "      \u003ctd\u003e87,571\u003c/td\u003e\n",
              "      \u003ctd\u003e49.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003e9\u003c/td\u003e\n",
              "      \u003ctd\u003e166,361\u003c/td\u003e\n",
              "      \u003ctd\u003e79,628\u003c/td\u003e\n",
              "      \u003ctd\u003e47.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e157,294\u003c/td\u003e\n",
              "      \u003ctd\u003e72,180\u003c/td\u003e\n",
              "      \u003ctd\u003e45.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e9\u003c/th\u003e\n",
              "      \u003ctd\u003e11\u003c/td\u003e\n",
              "      \u003ctd\u003e148,167\u003c/td\u003e\n",
              "      \u003ctd\u003e64,678\u003c/td\u003e\n",
              "      \u003ctd\u003e43.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e10\u003c/th\u003e\n",
              "      \u003ctd\u003e12\u003c/td\u003e\n",
              "      \u003ctd\u003e138,815\u003c/td\u003e\n",
              "      \u003ctd\u003e57,348\u003c/td\u003e\n",
              "      \u003ctd\u003e41.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e11\u003c/th\u003e\n",
              "      \u003ctd\u003e13\u003c/td\u003e\n",
              "      \u003ctd\u003e129,433\u003c/td\u003e\n",
              "      \u003ctd\u003e50,330\u003c/td\u003e\n",
              "      \u003ctd\u003e38.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e12\u003c/th\u003e\n",
              "      \u003ctd\u003e14\u003c/td\u003e\n",
              "      \u003ctd\u003e119,469\u003c/td\u003e\n",
              "      \u003ctd\u003e43,236\u003c/td\u003e\n",
              "      \u003ctd\u003e36.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e13\u003c/th\u003e\n",
              "      \u003ctd\u003e15\u003c/td\u003e\n",
              "      \u003ctd\u003e109,474\u003c/td\u003e\n",
              "      \u003ctd\u003e36,173\u003c/td\u003e\n",
              "      \u003ctd\u003e33.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e14\u003c/th\u003e\n",
              "      \u003ctd\u003e16\u003c/td\u003e\n",
              "      \u003ctd\u003e99,137\u003c/td\u003e\n",
              "      \u003ctd\u003e29,326\u003c/td\u003e\n",
              "      \u003ctd\u003e29.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e15\u003c/th\u003e\n",
              "      \u003ctd\u003e17\u003c/td\u003e\n",
              "      \u003ctd\u003e88,694\u003c/td\u003e\n",
              "      \u003ctd\u003e22,901\u003c/td\u003e\n",
              "      \u003ctd\u003e25.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e16\u003c/th\u003e\n",
              "      \u003ctd\u003e18\u003c/td\u003e\n",
              "      \u003ctd\u003e78,951\u003c/td\u003e\n",
              "      \u003ctd\u003e17,588\u003c/td\u003e\n",
              "      \u003ctd\u003e22.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e17\u003c/th\u003e\n",
              "      \u003ctd\u003e19\u003c/td\u003e\n",
              "      \u003ctd\u003e69,612\u003c/td\u003e\n",
              "      \u003ctd\u003e13,233\u003c/td\u003e\n",
              "      \u003ctd\u003e19.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e18\u003c/th\u003e\n",
              "      \u003ctd\u003e20\u003c/td\u003e\n",
              "      \u003ctd\u003e60,049\u003c/td\u003e\n",
              "      \u003ctd\u003e9,710\u003c/td\u003e\n",
              "      \u003ctd\u003e16.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e19\u003c/th\u003e\n",
              "      \u003ctd\u003e21\u003c/td\u003e\n",
              "      \u003ctd\u003e51,164\u003c/td\u003e\n",
              "      \u003ctd\u003e7,048\u003c/td\u003e\n",
              "      \u003ctd\u003e13.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e20\u003c/th\u003e\n",
              "      \u003ctd\u003e22\u003c/td\u003e\n",
              "      \u003ctd\u003e42,202\u003c/td\u003e\n",
              "      \u003ctd\u003e4,952\u003c/td\u003e\n",
              "      \u003ctd\u003e11.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e21\u003c/th\u003e\n",
              "      \u003ctd\u003e23\u003c/td\u003e\n",
              "      \u003ctd\u003e33,500\u003c/td\u003e\n",
              "      \u003ctd\u003e3,301\u003c/td\u003e\n",
              "      \u003ctd\u003e9.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e22\u003c/th\u003e\n",
              "      \u003ctd\u003e24\u003c/td\u003e\n",
              "      \u003ctd\u003e24,879\u003c/td\u003e\n",
              "      \u003ctd\u003e1,983\u003c/td\u003e\n",
              "      \u003ctd\u003e8.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e23\u003c/th\u003e\n",
              "      \u003ctd\u003e25\u003c/td\u003e\n",
              "      \u003ctd\u003e16,977\u003c/td\u003e\n",
              "      \u003ctd\u003e1,038\u003c/td\u003e\n",
              "      \u003ctd\u003e6.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e24\u003c/th\u003e\n",
              "      \u003ctd\u003e26\u003c/td\u003e\n",
              "      \u003ctd\u003e11,089\u003c/td\u003e\n",
              "      \u003ctd\u003e484\u003c/td\u003e\n",
              "      \u003ctd\u003e4.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e25\u003c/th\u003e\n",
              "      \u003ctd\u003e27\u003c/td\u003e\n",
              "      \u003ctd\u003e7,350\u003c/td\u003e\n",
              "      \u003ctd\u003e196\u003c/td\u003e\n",
              "      \u003ctd\u003e2.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e26\u003c/th\u003e\n",
              "      \u003ctd\u003e28\u003c/td\u003e\n",
              "      \u003ctd\u003e4,094\u003c/td\u003e\n",
              "      \u003ctd\u003e52\u003c/td\u003e\n",
              "      \u003ctd\u003e1.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e27\u003c/th\u003e\n",
              "      \u003ctd\u003e29\u003c/td\u003e\n",
              "      \u003ctd\u003e1,489\u003c/td\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e0.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "    min_mutations # generated # viable % viable\n",
              "0               2     201,426  110,689    55.0%\n",
              "1               3     201,426  110,689    55.0%\n",
              "2               4     201,424  110,687    55.0%\n",
              "3               5     201,368  110,633    54.9%\n",
              "4               6     193,413  103,403    53.5%\n",
              "5               7     184,424   95,422    51.7%\n",
              "6               8     175,443   87,571    49.9%\n",
              "7               9     166,361   79,628    47.9%\n",
              "8              10     157,294   72,180    45.9%\n",
              "9              11     148,167   64,678    43.7%\n",
              "10             12     138,815   57,348    41.3%\n",
              "11             13     129,433   50,330    38.9%\n",
              "12             14     119,469   43,236    36.2%\n",
              "13             15     109,474   36,173    33.0%\n",
              "14             16      99,137   29,326    29.6%\n",
              "15             17      88,694   22,901    25.8%\n",
              "16             18      78,951   17,588    22.3%\n",
              "17             19      69,612   13,233    19.0%\n",
              "18             20      60,049    9,710    16.2%\n",
              "19             21      51,164    7,048    13.8%\n",
              "20             22      42,202    4,952    11.7%\n",
              "21             23      33,500    3,301     9.9%\n",
              "22             24      24,879    1,983     8.0%\n",
              "23             25      16,977    1,038     6.1%\n",
              "24             26      11,089      484     4.4%\n",
              "25             27       7,350      196     2.7%\n",
              "26             28       4,094       52     1.3%\n",
              "27             29       1,489       10     0.7%"
            ]
          },
          "execution_count": 5,
          "metadata": {
            "tags": []
          },
          "output_type": "execute_result"
        }
      ],
      "source": [
        "performance_by_wt_distance(df, ml_generated_partitions)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "631cVi_OT6Ff"
      },
      "source": [
        "### SI Table 2"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 917
        },
        "executionInfo": {
          "elapsed": 4564,
          "status": "ok",
          "timestamp": 1587666830280,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "EUNCmLuGT7hu",
        "outputId": "69e5f6c7-86dc-40f2-b7ee-9ea065ec76c9"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003emin_mutations\u003c/th\u003e\n",
              "      \u003cth\u003e# generated\u003c/th\u003e\n",
              "      \u003cth\u003e# viable\u003c/th\u003e\n",
              "      \u003cth\u003e% viable\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e183,466\u003c/td\u003e\n",
              "      \u003ctd\u003e106,665\u003c/td\u003e\n",
              "      \u003ctd\u003e58.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e183,466\u003c/td\u003e\n",
              "      \u003ctd\u003e106,665\u003c/td\u003e\n",
              "      \u003ctd\u003e58.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e183,464\u003c/td\u003e\n",
              "      \u003ctd\u003e106,663\u003c/td\u003e\n",
              "      \u003ctd\u003e58.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e183,411\u003c/td\u003e\n",
              "      \u003ctd\u003e106,612\u003c/td\u003e\n",
              "      \u003ctd\u003e58.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e176,351\u003c/td\u003e\n",
              "      \u003ctd\u003e100,150\u003c/td\u003e\n",
              "      \u003ctd\u003e56.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003e7\u003c/td\u003e\n",
              "      \u003ctd\u003e168,231\u003c/td\u003e\n",
              "      \u003ctd\u003e92,923\u003c/td\u003e\n",
              "      \u003ctd\u003e55.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003e8\u003c/td\u003e\n",
              "      \u003ctd\u003e160,096\u003c/td\u003e\n",
              "      \u003ctd\u003e85,766\u003c/td\u003e\n",
              "      \u003ctd\u003e53.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003e9\u003c/td\u003e\n",
              "      \u003ctd\u003e151,805\u003c/td\u003e\n",
              "      \u003ctd\u003e78,411\u003c/td\u003e\n",
              "      \u003ctd\u003e51.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e143,464\u003c/td\u003e\n",
              "      \u003ctd\u003e71,416\u003c/td\u003e\n",
              "      \u003ctd\u003e49.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e9\u003c/th\u003e\n",
              "      \u003ctd\u003e11\u003c/td\u003e\n",
              "      \u003ctd\u003e135,099\u003c/td\u003e\n",
              "      \u003ctd\u003e64,267\u003c/td\u003e\n",
              "      \u003ctd\u003e47.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e10\u003c/th\u003e\n",
              "      \u003ctd\u003e12\u003c/td\u003e\n",
              "      \u003ctd\u003e126,589\u003c/td\u003e\n",
              "      \u003ctd\u003e57,157\u003c/td\u003e\n",
              "      \u003ctd\u003e45.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e11\u003c/th\u003e\n",
              "      \u003ctd\u003e13\u003c/td\u003e\n",
              "      \u003ctd\u003e118,046\u003c/td\u003e\n",
              "      \u003ctd\u003e50,243\u003c/td\u003e\n",
              "      \u003ctd\u003e42.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e12\u003c/th\u003e\n",
              "      \u003ctd\u003e14\u003c/td\u003e\n",
              "      \u003ctd\u003e108,965\u003c/td\u003e\n",
              "      \u003ctd\u003e43,188\u003c/td\u003e\n",
              "      \u003ctd\u003e39.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e13\u003c/th\u003e\n",
              "      \u003ctd\u003e15\u003c/td\u003e\n",
              "      \u003ctd\u003e99,868\u003c/td\u003e\n",
              "      \u003ctd\u003e36,138\u003c/td\u003e\n",
              "      \u003ctd\u003e36.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e14\u003c/th\u003e\n",
              "      \u003ctd\u003e16\u003c/td\u003e\n",
              "      \u003ctd\u003e90,448\u003c/td\u003e\n",
              "      \u003ctd\u003e29,299\u003c/td\u003e\n",
              "      \u003ctd\u003e32.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e15\u003c/th\u003e\n",
              "      \u003ctd\u003e17\u003c/td\u003e\n",
              "      \u003ctd\u003e80,932\u003c/td\u003e\n",
              "      \u003ctd\u003e22,879\u003c/td\u003e\n",
              "      \u003ctd\u003e28.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e16\u003c/th\u003e\n",
              "      \u003ctd\u003e18\u003c/td\u003e\n",
              "      \u003ctd\u003e72,082\u003c/td\u003e\n",
              "      \u003ctd\u003e17,571\u003c/td\u003e\n",
              "      \u003ctd\u003e24.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e17\u003c/th\u003e\n",
              "      \u003ctd\u003e19\u003c/td\u003e\n",
              "      \u003ctd\u003e63,657\u003c/td\u003e\n",
              "      \u003ctd\u003e13,217\u003c/td\u003e\n",
              "      \u003ctd\u003e20.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e18\u003c/th\u003e\n",
              "      \u003ctd\u003e20\u003c/td\u003e\n",
              "      \u003ctd\u003e55,026\u003c/td\u003e\n",
              "      \u003ctd\u003e9,698\u003c/td\u003e\n",
              "      \u003ctd\u003e17.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e19\u003c/th\u003e\n",
              "      \u003ctd\u003e21\u003c/td\u003e\n",
              "      \u003ctd\u003e47,032\u003c/td\u003e\n",
              "      \u003ctd\u003e7,039\u003c/td\u003e\n",
              "      \u003ctd\u003e15.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e20\u003c/th\u003e\n",
              "      \u003ctd\u003e22\u003c/td\u003e\n",
              "      \u003ctd\u003e38,986\u003c/td\u003e\n",
              "      \u003ctd\u003e4,946\u003c/td\u003e\n",
              "      \u003ctd\u003e12.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e21\u003c/th\u003e\n",
              "      \u003ctd\u003e23\u003c/td\u003e\n",
              "      \u003ctd\u003e31,190\u003c/td\u003e\n",
              "      \u003ctd\u003e3,297\u003c/td\u003e\n",
              "      \u003ctd\u003e10.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e22\u003c/th\u003e\n",
              "      \u003ctd\u003e24\u003c/td\u003e\n",
              "      \u003ctd\u003e23,441\u003c/td\u003e\n",
              "      \u003ctd\u003e1,980\u003c/td\u003e\n",
              "      \u003ctd\u003e8.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e23\u003c/th\u003e\n",
              "      \u003ctd\u003e25\u003c/td\u003e\n",
              "      \u003ctd\u003e16,395\u003c/td\u003e\n",
              "      \u003ctd\u003e1,037\u003c/td\u003e\n",
              "      \u003ctd\u003e6.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e24\u003c/th\u003e\n",
              "      \u003ctd\u003e26\u003c/td\u003e\n",
              "      \u003ctd\u003e11,089\u003c/td\u003e\n",
              "      \u003ctd\u003e484\u003c/td\u003e\n",
              "      \u003ctd\u003e4.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e25\u003c/th\u003e\n",
              "      \u003ctd\u003e27\u003c/td\u003e\n",
              "      \u003ctd\u003e7,350\u003c/td\u003e\n",
              "      \u003ctd\u003e196\u003c/td\u003e\n",
              "      \u003ctd\u003e2.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e26\u003c/th\u003e\n",
              "      \u003ctd\u003e28\u003c/td\u003e\n",
              "      \u003ctd\u003e4,094\u003c/td\u003e\n",
              "      \u003ctd\u003e52\u003c/td\u003e\n",
              "      \u003ctd\u003e1.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e27\u003c/th\u003e\n",
              "      \u003ctd\u003e29\u003c/td\u003e\n",
              "      \u003ctd\u003e1,489\u003c/td\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e0.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "    min_mutations # generated # viable % viable\n",
              "0               2     183,466  106,665    58.1%\n",
              "1               3     183,466  106,665    58.1%\n",
              "2               4     183,464  106,663    58.1%\n",
              "3               5     183,411  106,612    58.1%\n",
              "4               6     176,351  100,150    56.8%\n",
              "5               7     168,231   92,923    55.2%\n",
              "6               8     160,096   85,766    53.6%\n",
              "7               9     151,805   78,411    51.7%\n",
              "8              10     143,464   71,416    49.8%\n",
              "9              11     135,099   64,267    47.6%\n",
              "10             12     126,589   57,157    45.2%\n",
              "11             13     118,046   50,243    42.6%\n",
              "12             14     108,965   43,188    39.6%\n",
              "13             15      99,868   36,138    36.2%\n",
              "14             16      90,448   29,299    32.4%\n",
              "15             17      80,932   22,879    28.3%\n",
              "16             18      72,082   17,571    24.4%\n",
              "17             19      63,657   13,217    20.8%\n",
              "18             20      55,026    9,698    17.6%\n",
              "19             21      47,032    7,039    15.0%\n",
              "20             22      38,986    4,946    12.7%\n",
              "21             23      31,190    3,297    10.6%\n",
              "22             24      23,441    1,980     8.4%\n",
              "23             25      16,395    1,037     6.3%\n",
              "24             26      11,089      484     4.4%\n",
              "25             27       7,350      196     2.7%\n",
              "26             28       4,094       52     1.3%\n",
              "27             29       1,489       10     0.7%"
            ]
          },
          "execution_count": 6,
          "metadata": {
            "tags": []
          },
          "output_type": "execute_result"
        }
      ],
      "source": [
        "performance_by_wt_distance(df, ml_designed_partitions)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "cp6WeNNzT-ze"
      },
      "source": [
        "### SI Table 3"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 917
        },
        "executionInfo": {
          "elapsed": 3047,
          "status": "ok",
          "timestamp": 1587666833361,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "-rDCrdAxT-lh",
        "outputId": "69d29e3f-567a-491b-a6a1-b0043b73b8ae"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003emin_mutations\u003c/th\u003e\n",
              "      \u003cth\u003e# generated\u003c/th\u003e\n",
              "      \u003cth\u003e# viable\u003c/th\u003e\n",
              "      \u003cth\u003e% viable\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e123,331\u003c/td\u003e\n",
              "      \u003ctd\u003e79,837\u003c/td\u003e\n",
              "      \u003ctd\u003e64.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e123,331\u003c/td\u003e\n",
              "      \u003ctd\u003e79,837\u003c/td\u003e\n",
              "      \u003ctd\u003e64.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e123,329\u003c/td\u003e\n",
              "      \u003ctd\u003e79,835\u003c/td\u003e\n",
              "      \u003ctd\u003e64.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e123,280\u003c/td\u003e\n",
              "      \u003ctd\u003e79,788\u003c/td\u003e\n",
              "      \u003ctd\u003e64.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e117,855\u003c/td\u003e\n",
              "      \u003ctd\u003e74,431\u003c/td\u003e\n",
              "      \u003ctd\u003e63.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003e7\u003c/td\u003e\n",
              "      \u003ctd\u003e112,376\u003c/td\u003e\n",
              "      \u003ctd\u003e69,020\u003c/td\u003e\n",
              "      \u003ctd\u003e61.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003e8\u003c/td\u003e\n",
              "      \u003ctd\u003e106,907\u003c/td\u003e\n",
              "      \u003ctd\u003e63,624\u003c/td\u003e\n",
              "      \u003ctd\u003e59.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003e9\u003c/td\u003e\n",
              "      \u003ctd\u003e101,326\u003c/td\u003e\n",
              "      \u003ctd\u003e58,145\u003c/td\u003e\n",
              "      \u003ctd\u003e57.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e95,698\u003c/td\u003e\n",
              "      \u003ctd\u003e52,658\u003c/td\u003e\n",
              "      \u003ctd\u003e55.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e9\u003c/th\u003e\n",
              "      \u003ctd\u003e11\u003c/td\u003e\n",
              "      \u003ctd\u003e90,035\u003c/td\u003e\n",
              "      \u003ctd\u003e47,192\u003c/td\u003e\n",
              "      \u003ctd\u003e52.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e10\u003c/th\u003e\n",
              "      \u003ctd\u003e12\u003c/td\u003e\n",
              "      \u003ctd\u003e84,291\u003c/td\u003e\n",
              "      \u003ctd\u003e41,688\u003c/td\u003e\n",
              "      \u003ctd\u003e49.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e11\u003c/th\u003e\n",
              "      \u003ctd\u003e13\u003c/td\u003e\n",
              "      \u003ctd\u003e78,449\u003c/td\u003e\n",
              "      \u003ctd\u003e36,219\u003c/td\u003e\n",
              "      \u003ctd\u003e46.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e12\u003c/th\u003e\n",
              "      \u003ctd\u003e14\u003c/td\u003e\n",
              "      \u003ctd\u003e72,332\u003c/td\u003e\n",
              "      \u003ctd\u003e30,635\u003c/td\u003e\n",
              "      \u003ctd\u003e42.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e13\u003c/th\u003e\n",
              "      \u003ctd\u003e15\u003c/td\u003e\n",
              "      \u003ctd\u003e65,960\u003c/td\u003e\n",
              "      \u003ctd\u003e24,953\u003c/td\u003e\n",
              "      \u003ctd\u003e37.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e14\u003c/th\u003e\n",
              "      \u003ctd\u003e16\u003c/td\u003e\n",
              "      \u003ctd\u003e59,277\u003c/td\u003e\n",
              "      \u003ctd\u003e19,247\u003c/td\u003e\n",
              "      \u003ctd\u003e32.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e15\u003c/th\u003e\n",
              "      \u003ctd\u003e17\u003c/td\u003e\n",
              "      \u003ctd\u003e52,702\u003c/td\u003e\n",
              "      \u003ctd\u003e13,997\u003c/td\u003e\n",
              "      \u003ctd\u003e26.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e16\u003c/th\u003e\n",
              "      \u003ctd\u003e18\u003c/td\u003e\n",
              "      \u003ctd\u003e46,774\u003c/td\u003e\n",
              "      \u003ctd\u003e9,856\u003c/td\u003e\n",
              "      \u003ctd\u003e21.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e17\u003c/th\u003e\n",
              "      \u003ctd\u003e19\u003c/td\u003e\n",
              "      \u003ctd\u003e41,028\u003c/td\u003e\n",
              "      \u003ctd\u003e6,559\u003c/td\u003e\n",
              "      \u003ctd\u003e16.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e18\u003c/th\u003e\n",
              "      \u003ctd\u003e20\u003c/td\u003e\n",
              "      \u003ctd\u003e35,300\u003c/td\u003e\n",
              "      \u003ctd\u003e4,092\u003c/td\u003e\n",
              "      \u003ctd\u003e11.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e19\u003c/th\u003e\n",
              "      \u003ctd\u003e21\u003c/td\u003e\n",
              "      \u003ctd\u003e30,053\u003c/td\u003e\n",
              "      \u003ctd\u003e2,482\u003c/td\u003e\n",
              "      \u003ctd\u003e8.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e20\u003c/th\u003e\n",
              "      \u003ctd\u003e22\u003c/td\u003e\n",
              "      \u003ctd\u003e24,771\u003c/td\u003e\n",
              "      \u003ctd\u003e1,385\u003c/td\u003e\n",
              "      \u003ctd\u003e5.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e21\u003c/th\u003e\n",
              "      \u003ctd\u003e23\u003c/td\u003e\n",
              "      \u003ctd\u003e19,712\u003c/td\u003e\n",
              "      \u003ctd\u003e670\u003c/td\u003e\n",
              "      \u003ctd\u003e3.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e22\u003c/th\u003e\n",
              "      \u003ctd\u003e24\u003c/td\u003e\n",
              "      \u003ctd\u003e15,145\u003c/td\u003e\n",
              "      \u003ctd\u003e338\u003c/td\u003e\n",
              "      \u003ctd\u003e2.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e23\u003c/th\u003e\n",
              "      \u003ctd\u003e25\u003c/td\u003e\n",
              "      \u003ctd\u003e10,854\u003c/td\u003e\n",
              "      \u003ctd\u003e165\u003c/td\u003e\n",
              "      \u003ctd\u003e1.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e24\u003c/th\u003e\n",
              "      \u003ctd\u003e26\u003c/td\u003e\n",
              "      \u003ctd\u003e7,306\u003c/td\u003e\n",
              "      \u003ctd\u003e72\u003c/td\u003e\n",
              "      \u003ctd\u003e1.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e25\u003c/th\u003e\n",
              "      \u003ctd\u003e27\u003c/td\u003e\n",
              "      \u003ctd\u003e4,887\u003c/td\u003e\n",
              "      \u003ctd\u003e47\u003c/td\u003e\n",
              "      \u003ctd\u003e1.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e26\u003c/th\u003e\n",
              "      \u003ctd\u003e28\u003c/td\u003e\n",
              "      \u003ctd\u003e2,666\u003c/td\u003e\n",
              "      \u003ctd\u003e15\u003c/td\u003e\n",
              "      \u003ctd\u003e0.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e27\u003c/th\u003e\n",
              "      \u003ctd\u003e29\u003c/td\u003e\n",
              "      \u003ctd\u003e942\u003c/td\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e0.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "    min_mutations # generated # viable % viable\n",
              "0               2     123,331   79,837    64.7%\n",
              "1               3     123,331   79,837    64.7%\n",
              "2               4     123,329   79,835    64.7%\n",
              "3               5     123,280   79,788    64.7%\n",
              "4               6     117,855   74,431    63.2%\n",
              "5               7     112,376   69,020    61.4%\n",
              "6               8     106,907   63,624    59.5%\n",
              "7               9     101,326   58,145    57.4%\n",
              "8              10      95,698   52,658    55.0%\n",
              "9              11      90,035   47,192    52.4%\n",
              "10             12      84,291   41,688    49.5%\n",
              "11             13      78,449   36,219    46.2%\n",
              "12             14      72,332   30,635    42.4%\n",
              "13             15      65,960   24,953    37.8%\n",
              "14             16      59,277   19,247    32.5%\n",
              "15             17      52,702   13,997    26.6%\n",
              "16             18      46,774    9,856    21.1%\n",
              "17             19      41,028    6,559    16.0%\n",
              "18             20      35,300    4,092    11.6%\n",
              "19             21      30,053    2,482     8.3%\n",
              "20             22      24,771    1,385     5.6%\n",
              "21             23      19,712      670     3.4%\n",
              "22             24      15,145      338     2.2%\n",
              "23             25      10,854      165     1.5%\n",
              "24             26       7,306       72     1.0%\n",
              "25             27       4,887       47     1.0%\n",
              "26             28       2,666       15     0.6%\n",
              "27             29         942        4     0.4%"
            ]
          },
          "execution_count": 7,
          "metadata": {
            "tags": []
          },
          "output_type": "execute_result"
        }
      ],
      "source": [
        "performance_by_wt_distance(df, nn_designed_partitions)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Jdrac7hHIMBR"
      },
      "source": [
        "#### SI Table 4"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 328
        },
        "executionInfo": {
          "elapsed": 1075,
          "status": "ok",
          "timestamp": 1587663669846,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "DJklFr9JIP9t",
        "outputId": "6af7953c-1a6f-452e-9520-84de7bdc613a"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003epartition\u003c/th\u003e\n",
              "      \u003cth\u003e# generated\u003c/th\u003e\n",
              "      \u003cth\u003e# viable\u003c/th\u003e\n",
              "      \u003cth\u003e% viable\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e2,071\u003c/td\u003e\n",
              "      \u003ctd\u003e114\u003c/td\u003e\n",
              "      \u003ctd\u003e5.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003elr_standard_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e1,989\u003c/td\u003e\n",
              "      \u003ctd\u003e486\u003c/td\u003e\n",
              "      \u003ctd\u003e24.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003elr_designed_plus_rand_train_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e2,030\u003c/td\u003e\n",
              "      \u003ctd\u003e340\u003c/td\u003e\n",
              "      \u003ctd\u003e16.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003ecnn_rand_doubles_plus_single_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e2,022\u003c/td\u003e\n",
              "      \u003ctd\u003e381\u003c/td\u003e\n",
              "      \u003ctd\u003e18.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003ecnn_standard_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e1,924\u003c/td\u003e\n",
              "      \u003ctd\u003e476\u003c/td\u003e\n",
              "      \u003ctd\u003e24.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003ecnn_designed_plus_rand_train_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e1,898\u003c/td\u003e\n",
              "      \u003ctd\u003e529\u003c/td\u003e\n",
              "      \u003ctd\u003e27.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003ernn_rand_doubles_plus_singles_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e2,045\u003c/td\u003e\n",
              "      \u003ctd\u003e575\u003c/td\u003e\n",
              "      \u003ctd\u003e28.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003ernn_standard_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e1,916\u003c/td\u003e\n",
              "      \u003ctd\u003e412\u003c/td\u003e\n",
              "      \u003ctd\u003e21.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_seed\u003c/td\u003e\n",
              "      \u003ctd\u003e2,065\u003c/td\u003e\n",
              "      \u003ctd\u003e711\u003c/td\u003e\n",
              "      \u003ctd\u003e34.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "                            partition # generated # viable % viable\n",
              "0    lr_rand_doubles_plus_single_seed       2,071      114     5.5%\n",
              "1                    lr_standard_seed       1,989      486    24.4%\n",
              "2    lr_designed_plus_rand_train_seed       2,030      340    16.7%\n",
              "3   cnn_rand_doubles_plus_single_seed       2,022      381    18.8%\n",
              "4                   cnn_standard_seed       1,924      476    24.7%\n",
              "5   cnn_designed_plus_rand_train_seed       1,898      529    27.9%\n",
              "6  rnn_rand_doubles_plus_singles_seed       2,045      575    28.1%\n",
              "7                   rnn_standard_seed       1,916      412    21.5%\n",
              "8   rnn_designed_plus_rand_train_seed       2,065      711    34.4%"
            ]
          },
          "metadata": {
            "tags": []
          },
          "output_type": "display_data"
        }
      ],
      "source": [
        "display(performance_by_model(df, ml_selected_partitions))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-w6qZAY7IQxc"
      },
      "source": [
        "#### SI Table 5"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 328
        },
        "executionInfo": {
          "elapsed": 1674,
          "status": "ok",
          "timestamp": 1587663681180,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "XesVFvBCINxz",
        "outputId": "d287f656-b234-4674-9441-106ad2621871"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003epartition\u003c/th\u003e\n",
              "      \u003cth\u003e# generated\u003c/th\u003e\n",
              "      \u003cth\u003e# viable\u003c/th\u003e\n",
              "      \u003cth\u003e% viable\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e19,999\u003c/td\u003e\n",
              "      \u003ctd\u003e1,483\u003c/td\u003e\n",
              "      \u003ctd\u003e7.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003elr_standard_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e20,456\u003c/td\u003e\n",
              "      \u003ctd\u003e19,211\u003c/td\u003e\n",
              "      \u003ctd\u003e93.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003elr_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e19,680\u003c/td\u003e\n",
              "      \u003ctd\u003e6,134\u003c/td\u003e\n",
              "      \u003ctd\u003e31.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003ecnn_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e20,454\u003c/td\u003e\n",
              "      \u003ctd\u003e11,229\u003c/td\u003e\n",
              "      \u003ctd\u003e54.9%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003ecnn_standard_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e20,395\u003c/td\u003e\n",
              "      \u003ctd\u003e13,086\u003c/td\u003e\n",
              "      \u003ctd\u003e64.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003ecnn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e20,759\u003c/td\u003e\n",
              "      \u003ctd\u003e14,968\u003c/td\u003e\n",
              "      \u003ctd\u003e72.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003ernn_rand_doubles_plus_singles_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e20,154\u003c/td\u003e\n",
              "      \u003ctd\u003e13,056\u003c/td\u003e\n",
              "      \u003ctd\u003e64.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003ernn_standard_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e20,838\u003c/td\u003e\n",
              "      \u003ctd\u003e15,525\u003c/td\u003e\n",
              "      \u003ctd\u003e74.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "      \u003ctd\u003e20,731\u003c/td\u003e\n",
              "      \u003ctd\u003e11,973\u003c/td\u003e\n",
              "      \u003ctd\u003e57.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "                              partition # generated # viable % viable\n",
              "0    lr_rand_doubles_plus_single_walked      19,999    1,483     7.4%\n",
              "1                    lr_standard_walked      20,456   19,211    93.9%\n",
              "2    lr_designed_plus_rand_train_walked      19,680    6,134    31.2%\n",
              "3   cnn_rand_doubles_plus_single_walked      20,454   11,229    54.9%\n",
              "4                   cnn_standard_walked      20,395   13,086    64.2%\n",
              "5   cnn_designed_plus_rand_train_walked      20,759   14,968    72.1%\n",
              "6  rnn_rand_doubles_plus_singles_walked      20,154   13,056    64.8%\n",
              "7                   rnn_standard_walked      20,838   15,525    74.5%\n",
              "8   rnn_designed_plus_rand_train_walked      20,731   11,973    57.8%"
            ]
          },
          "metadata": {
            "tags": []
          },
          "output_type": "display_data"
        }
      ],
      "source": [
        "display(performance_by_model(df, ml_designed_partitions))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "QCMV4Bv4UIK9"
      },
      "source": [
        "### SI Table 6"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 1000
        },
        "executionInfo": {
          "elapsed": 2304,
          "status": "ok",
          "timestamp": 1587667439692,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "yv9LnRjfUCNe",
        "outputId": "b1ca53e7-8e17-4aef-f25b-6976c5bd8a60"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003emin_mutations\u003c/th\u003e\n",
              "      \u003cth\u003e# generated\u003c/th\u003e\n",
              "      \u003cth\u003e# viable\u003c/th\u003e\n",
              "      \u003cth\u003e% viable\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e56,372\u003c/td\u003e\n",
              "      \u003ctd\u003e35,217\u003c/td\u003e\n",
              "      \u003ctd\u003e62.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e50,572\u003c/td\u003e\n",
              "      \u003ctd\u003e30,068\u003c/td\u003e\n",
              "      \u003ctd\u003e59.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e41,232\u003c/td\u003e\n",
              "      \u003ctd\u003e22,129\u003c/td\u003e\n",
              "      \u003ctd\u003e53.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e31,561\u003c/td\u003e\n",
              "      \u003ctd\u003e14,551\u003c/td\u003e\n",
              "      \u003ctd\u003e46.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e22,407\u003c/td\u003e\n",
              "      \u003ctd\u003e8,159\u003c/td\u003e\n",
              "      \u003ctd\u003e36.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003e7\u003c/td\u003e\n",
              "      \u003ctd\u003e13,892\u003c/td\u003e\n",
              "      \u003ctd\u003e2,953\u003c/td\u003e\n",
              "      \u003ctd\u003e21.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003e8\u003c/td\u003e\n",
              "      \u003ctd\u003e12,603\u003c/td\u003e\n",
              "      \u003ctd\u003e2,181\u003c/td\u003e\n",
              "      \u003ctd\u003e17.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003e9\u003c/td\u003e\n",
              "      \u003ctd\u003e11,387\u003c/td\u003e\n",
              "      \u003ctd\u003e1,561\u003c/td\u003e\n",
              "      \u003ctd\u003e13.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e10,245\u003c/td\u003e\n",
              "      \u003ctd\u003e1,101\u003c/td\u003e\n",
              "      \u003ctd\u003e10.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e9\u003c/th\u003e\n",
              "      \u003ctd\u003e11\u003c/td\u003e\n",
              "      \u003ctd\u003e9,171\u003c/td\u003e\n",
              "      \u003ctd\u003e757\u003c/td\u003e\n",
              "      \u003ctd\u003e8.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e10\u003c/th\u003e\n",
              "      \u003ctd\u003e12\u003c/td\u003e\n",
              "      \u003ctd\u003e8,160\u003c/td\u003e\n",
              "      \u003ctd\u003e511\u003c/td\u003e\n",
              "      \u003ctd\u003e6.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e11\u003c/th\u003e\n",
              "      \u003ctd\u003e13\u003c/td\u003e\n",
              "      \u003ctd\u003e7,195\u003c/td\u003e\n",
              "      \u003ctd\u003e340\u003c/td\u003e\n",
              "      \u003ctd\u003e4.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e12\u003c/th\u003e\n",
              "      \u003ctd\u003e14\u003c/td\u003e\n",
              "      \u003ctd\u003e6,312\u003c/td\u003e\n",
              "      \u003ctd\u003e224\u003c/td\u003e\n",
              "      \u003ctd\u003e3.5%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e13\u003c/th\u003e\n",
              "      \u003ctd\u003e15\u003c/td\u003e\n",
              "      \u003ctd\u003e5,495\u003c/td\u003e\n",
              "      \u003ctd\u003e134\u003c/td\u003e\n",
              "      \u003ctd\u003e2.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e14\u003c/th\u003e\n",
              "      \u003ctd\u003e16\u003c/td\u003e\n",
              "      \u003ctd\u003e4,757\u003c/td\u003e\n",
              "      \u003ctd\u003e74\u003c/td\u003e\n",
              "      \u003ctd\u003e1.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e15\u003c/th\u003e\n",
              "      \u003ctd\u003e17\u003c/td\u003e\n",
              "      \u003ctd\u003e4,102\u003c/td\u003e\n",
              "      \u003ctd\u003e42\u003c/td\u003e\n",
              "      \u003ctd\u003e1.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e16\u003c/th\u003e\n",
              "      \u003ctd\u003e18\u003c/td\u003e\n",
              "      \u003ctd\u003e3,522\u003c/td\u003e\n",
              "      \u003ctd\u003e22\u003c/td\u003e\n",
              "      \u003ctd\u003e0.6%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e17\u003c/th\u003e\n",
              "      \u003ctd\u003e19\u003c/td\u003e\n",
              "      \u003ctd\u003e2,994\u003c/td\u003e\n",
              "      \u003ctd\u003e13\u003c/td\u003e\n",
              "      \u003ctd\u003e0.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e18\u003c/th\u003e\n",
              "      \u003ctd\u003e20\u003c/td\u003e\n",
              "      \u003ctd\u003e2,541\u003c/td\u003e\n",
              "      \u003ctd\u003e8\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e19\u003c/th\u003e\n",
              "      \u003ctd\u003e21\u003c/td\u003e\n",
              "      \u003ctd\u003e2,148\u003c/td\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e0.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e20\u003c/th\u003e\n",
              "      \u003ctd\u003e22\u003c/td\u003e\n",
              "      \u003ctd\u003e1,790\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e21\u003c/th\u003e\n",
              "      \u003ctd\u003e23\u003c/td\u003e\n",
              "      \u003ctd\u003e1,499\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e22\u003c/th\u003e\n",
              "      \u003ctd\u003e24\u003c/td\u003e\n",
              "      \u003ctd\u003e1,237\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e23\u003c/th\u003e\n",
              "      \u003ctd\u003e25\u003c/td\u003e\n",
              "      \u003ctd\u003e1,020\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e24\u003c/th\u003e\n",
              "      \u003ctd\u003e26\u003c/td\u003e\n",
              "      \u003ctd\u003e833\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e25\u003c/th\u003e\n",
              "      \u003ctd\u003e27\u003c/td\u003e\n",
              "      \u003ctd\u003e682\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e26\u003c/th\u003e\n",
              "      \u003ctd\u003e28\u003c/td\u003e\n",
              "      \u003ctd\u003e564\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e27\u003c/th\u003e\n",
              "      \u003ctd\u003e29\u003c/td\u003e\n",
              "      \u003ctd\u003e458\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e28\u003c/th\u003e\n",
              "      \u003ctd\u003e30\u003c/td\u003e\n",
              "      \u003ctd\u003e364\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e29\u003c/th\u003e\n",
              "      \u003ctd\u003e31\u003c/td\u003e\n",
              "      \u003ctd\u003e279\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e30\u003c/th\u003e\n",
              "      \u003ctd\u003e32\u003c/td\u003e\n",
              "      \u003ctd\u003e216\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e31\u003c/th\u003e\n",
              "      \u003ctd\u003e33\u003c/td\u003e\n",
              "      \u003ctd\u003e166\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e32\u003c/th\u003e\n",
              "      \u003ctd\u003e34\u003c/td\u003e\n",
              "      \u003ctd\u003e119\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e33\u003c/th\u003e\n",
              "      \u003ctd\u003e35\u003c/td\u003e\n",
              "      \u003ctd\u003e77\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e34\u003c/th\u003e\n",
              "      \u003ctd\u003e36\u003c/td\u003e\n",
              "      \u003ctd\u003e48\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e35\u003c/th\u003e\n",
              "      \u003ctd\u003e37\u003c/td\u003e\n",
              "      \u003ctd\u003e30\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e36\u003c/th\u003e\n",
              "      \u003ctd\u003e38\u003c/td\u003e\n",
              "      \u003ctd\u003e16\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e37\u003c/th\u003e\n",
              "      \u003ctd\u003e39\u003c/td\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "    min_mutations # generated # viable % viable\n",
              "0               2      56,372   35,217    62.5%\n",
              "1               3      50,572   30,068    59.5%\n",
              "2               4      41,232   22,129    53.7%\n",
              "3               5      31,561   14,551    46.1%\n",
              "4               6      22,407    8,159    36.4%\n",
              "5               7      13,892    2,953    21.3%\n",
              "6               8      12,603    2,181    17.3%\n",
              "7               9      11,387    1,561    13.7%\n",
              "8              10      10,245    1,101    10.7%\n",
              "9              11       9,171      757     8.3%\n",
              "10             12       8,160      511     6.3%\n",
              "11             13       7,195      340     4.7%\n",
              "12             14       6,312      224     3.5%\n",
              "13             15       5,495      134     2.4%\n",
              "14             16       4,757       74     1.6%\n",
              "15             17       4,102       42     1.0%\n",
              "16             18       3,522       22     0.6%\n",
              "17             19       2,994       13     0.4%\n",
              "18             20       2,541        8     0.3%\n",
              "19             21       2,148        2     0.1%\n",
              "20             22       1,790        0     0.0%\n",
              "21             23       1,499        0     0.0%\n",
              "22             24       1,237        0     0.0%\n",
              "23             25       1,020        0     0.0%\n",
              "24             26         833        0     0.0%\n",
              "25             27         682        0     0.0%\n",
              "26             28         564        0     0.0%\n",
              "27             29         458        0     0.0%\n",
              "28             30         364        0     0.0%\n",
              "29             31         279        0     0.0%\n",
              "30             32         216        0     0.0%\n",
              "31             33         166        0     0.0%\n",
              "32             34         119        0     0.0%\n",
              "33             35          77        0     0.0%\n",
              "34             36          48        0     0.0%\n",
              "35             37          30        0     0.0%\n",
              "36             38          16        0     0.0%\n",
              "37             39           3        0     0.0%"
            ]
          },
          "execution_count": 10,
          "metadata": {
            "tags": []
          },
          "output_type": "execute_result"
        }
      ],
      "source": [
        "performance_by_wt_distance(df, baseline_additive_partitions, distances=range(2, 40))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "UUrpBsIpUJ6S"
      },
      "source": [
        "### SI Table 7"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 328
        },
        "executionInfo": {
          "elapsed": 1005,
          "status": "ok",
          "timestamp": 1587667454537,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "7hBFsec2UC1f",
        "outputId": "1d099ebd-b458-4421-e64f-7ecfd628f9ad"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003emin_mutations\u003c/th\u003e\n",
              "      \u003cth\u003e# generated\u003c/th\u003e\n",
              "      \u003cth\u003e# viable\u003c/th\u003e\n",
              "      \u003cth\u003e% viable\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e9,885\u003c/td\u003e\n",
              "      \u003ctd\u003e964\u003c/td\u003e\n",
              "      \u003ctd\u003e9.8%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e8,129\u003c/td\u003e\n",
              "      \u003ctd\u003e461\u003c/td\u003e\n",
              "      \u003ctd\u003e5.7%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e6,378\u003c/td\u003e\n",
              "      \u003ctd\u003e213\u003c/td\u003e\n",
              "      \u003ctd\u003e3.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e4,631\u003c/td\u003e\n",
              "      \u003ctd\u003e93\u003c/td\u003e\n",
              "      \u003ctd\u003e2.0%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e2,883\u003c/td\u003e\n",
              "      \u003ctd\u003e32\u003c/td\u003e\n",
              "      \u003ctd\u003e1.1%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003e7\u003c/td\u003e\n",
              "      \u003ctd\u003e1,154\u003c/td\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003e8\u003c/td\u003e\n",
              "      \u003ctd\u003e866\u003c/td\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e0.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003e9\u003c/td\u003e\n",
              "      \u003ctd\u003e576\u003c/td\u003e\n",
              "      \u003ctd\u003e1\u003c/td\u003e\n",
              "      \u003ctd\u003e0.2%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e284\u003c/td\u003e\n",
              "      \u003ctd\u003e1\u003c/td\u003e\n",
              "      \u003ctd\u003e0.4%\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "   min_mutations # generated # viable % viable\n",
              "0              2       9,885      964     9.8%\n",
              "1              3       8,129      461     5.7%\n",
              "2              4       6,378      213     3.3%\n",
              "3              5       4,631       93     2.0%\n",
              "4              6       2,883       32     1.1%\n",
              "5              7       1,154        3     0.3%\n",
              "6              8         866        2     0.2%\n",
              "7              9         576        1     0.2%\n",
              "8             10         284        1     0.4%"
            ]
          },
          "execution_count": 11,
          "metadata": {
            "tags": []
          },
          "output_type": "execute_result"
        }
      ],
      "source": [
        "performance_by_wt_distance(df, baseline_random_partitions, distances=range(2, 11))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "OaLKqS6rWkJd"
      },
      "source": [
        "## Additional: performance vs wt distance per model "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "height": 1000
        },
        "executionInfo": {
          "elapsed": 8019,
          "status": "ok",
          "timestamp": 1587748547165,
          "user": {
            "displayName": "Drew Bryant",
            "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GhjrwHP04-I6-W9Av5JA_0CcKdWpyBY6xXP4bIkKQ=s64",
            "userId": "08803775622515208342"
          },
          "user_tz": 300
        },
        "id": "lmN-kFO3WjYk",
        "outputId": "a6f3ee79-053f-47f8-85cb-d3c7d97e0b83"
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border=\"1\" class=\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style=\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003emin_mutations\u003c/th\u003e\n",
              "      \u003cth\u003e# generated\u003c/th\u003e\n",
              "      \u003cth\u003e# viable\u003c/th\u003e\n",
              "      \u003cth\u003e% viable\u003c/th\u003e\n",
              "      \u003cth\u003epartition\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e19,999\u003c/td\u003e\n",
              "      \u003ctd\u003e1,483\u003c/td\u003e\n",
              "      \u003ctd\u003e7.4%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e19,999\u003c/td\u003e\n",
              "      \u003ctd\u003e1,483\u003c/td\u003e\n",
              "      \u003ctd\u003e7.4%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e19,999\u003c/td\u003e\n",
              "      \u003ctd\u003e1,483\u003c/td\u003e\n",
              "      \u003ctd\u003e7.4%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e19,998\u003c/td\u003e\n",
              "      \u003ctd\u003e1,482\u003c/td\u003e\n",
              "      \u003ctd\u003e7.4%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e19,375\u003c/td\u003e\n",
              "      \u003ctd\u003e1,265\u003c/td\u003e\n",
              "      \u003ctd\u003e6.5%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003e7\u003c/td\u003e\n",
              "      \u003ctd\u003e18,504\u003c/td\u003e\n",
              "      \u003ctd\u003e1,005\u003c/td\u003e\n",
              "      \u003ctd\u003e5.4%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003e8\u003c/td\u003e\n",
              "      \u003ctd\u003e17,613\u003c/td\u003e\n",
              "      \u003ctd\u003e881\u003c/td\u003e\n",
              "      \u003ctd\u003e5.0%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003e9\u003c/td\u003e\n",
              "      \u003ctd\u003e16,712\u003c/td\u003e\n",
              "      \u003ctd\u003e592\u003c/td\u003e\n",
              "      \u003ctd\u003e3.5%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e15,829\u003c/td\u003e\n",
              "      \u003ctd\u003e570\u003c/td\u003e\n",
              "      \u003ctd\u003e3.6%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e9\u003c/th\u003e\n",
              "      \u003ctd\u003e11\u003c/td\u003e\n",
              "      \u003ctd\u003e14,895\u003c/td\u003e\n",
              "      \u003ctd\u003e349\u003c/td\u003e\n",
              "      \u003ctd\u003e2.3%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e10\u003c/th\u003e\n",
              "      \u003ctd\u003e12\u003c/td\u003e\n",
              "      \u003ctd\u003e14,002\u003c/td\u003e\n",
              "      \u003ctd\u003e230\u003c/td\u003e\n",
              "      \u003ctd\u003e1.6%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e11\u003c/th\u003e\n",
              "      \u003ctd\u003e13\u003c/td\u003e\n",
              "      \u003ctd\u003e13,151\u003c/td\u003e\n",
              "      \u003ctd\u003e162\u003c/td\u003e\n",
              "      \u003ctd\u003e1.2%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e12\u003c/th\u003e\n",
              "      \u003ctd\u003e14\u003c/td\u003e\n",
              "      \u003ctd\u003e12,104\u003c/td\u003e\n",
              "      \u003ctd\u003e84\u003c/td\u003e\n",
              "      \u003ctd\u003e0.7%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e13\u003c/th\u003e\n",
              "      \u003ctd\u003e15\u003c/td\u003e\n",
              "      \u003ctd\u003e11,333\u003c/td\u003e\n",
              "      \u003ctd\u003e78\u003c/td\u003e\n",
              "      \u003ctd\u003e0.7%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e14\u003c/th\u003e\n",
              "      \u003ctd\u003e16\u003c/td\u003e\n",
              "      \u003ctd\u003e10,368\u003c/td\u003e\n",
              "      \u003ctd\u003e70\u003c/td\u003e\n",
              "      \u003ctd\u003e0.7%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e15\u003c/th\u003e\n",
              "      \u003ctd\u003e17\u003c/td\u003e\n",
              "      \u003ctd\u003e9,366\u003c/td\u003e\n",
              "      \u003ctd\u003e55\u003c/td\u003e\n",
              "      \u003ctd\u003e0.6%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e16\u003c/th\u003e\n",
              "      \u003ctd\u003e18\u003c/td\u003e\n",
              "      \u003ctd\u003e8,417\u003c/td\u003e\n",
              "      \u003ctd\u003e50\u003c/td\u003e\n",
              "      \u003ctd\u003e0.6%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e17\u003c/th\u003e\n",
              "      \u003ctd\u003e19\u003c/td\u003e\n",
              "      \u003ctd\u003e7,549\u003c/td\u003e\n",
              "      \u003ctd\u003e43\u003c/td\u003e\n",
              "      \u003ctd\u003e0.6%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e18\u003c/th\u003e\n",
              "      \u003ctd\u003e20\u003c/td\u003e\n",
              "      \u003ctd\u003e6,570\u003c/td\u003e\n",
              "      \u003ctd\u003e32\u003c/td\u003e\n",
              "      \u003ctd\u003e0.5%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e19\u003c/th\u003e\n",
              "      \u003ctd\u003e21\u003c/td\u003e\n",
              "      \u003ctd\u003e5,654\u003c/td\u003e\n",
              "      \u003ctd\u003e19\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e20\u003c/th\u003e\n",
              "      \u003ctd\u003e22\u003c/td\u003e\n",
              "      \u003ctd\u003e4,800\u003c/td\u003e\n",
              "      \u003ctd\u003e15\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e21\u003c/th\u003e\n",
              "      \u003ctd\u003e23\u003c/td\u003e\n",
              "      \u003ctd\u003e4,028\u003c/td\u003e\n",
              "      \u003ctd\u003e14\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e22\u003c/th\u003e\n",
              "      \u003ctd\u003e24\u003c/td\u003e\n",
              "      \u003ctd\u003e2,790\u003c/td\u003e\n",
              "      \u003ctd\u003e9\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e23\u003c/th\u003e\n",
              "      \u003ctd\u003e25\u003c/td\u003e\n",
              "      \u003ctd\u003e1,768\u003c/td\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e24\u003c/th\u003e\n",
              "      \u003ctd\u003e26\u003c/td\u003e\n",
              "      \u003ctd\u003e1,211\u003c/td\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e25\u003c/th\u003e\n",
              "      \u003ctd\u003e27\u003c/td\u003e\n",
              "      \u003ctd\u003e759\u003c/td\u003e\n",
              "      \u003ctd\u003e1\u003c/td\u003e\n",
              "      \u003ctd\u003e0.1%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e26\u003c/th\u003e\n",
              "      \u003ctd\u003e28\u003c/td\u003e\n",
              "      \u003ctd\u003e436\u003c/td\u003e\n",
              "      \u003ctd\u003e1\u003c/td\u003e\n",
              "      \u003ctd\u003e0.2%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e27\u003c/th\u003e\n",
              "      \u003ctd\u003e29\u003c/td\u003e\n",
              "      \u003ctd\u003e180\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_rand_doubles_plus_single_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e20,456\u003c/td\u003e\n",
              "      \u003ctd\u003e19,211\u003c/td\u003e\n",
              "      \u003ctd\u003e93.9%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_standard_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e20,456\u003c/td\u003e\n",
              "      \u003ctd\u003e19,211\u003c/td\u003e\n",
              "      \u003ctd\u003e93.9%\u003c/td\u003e\n",
              "      \u003ctd\u003elr_standard_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e...\u003c/th\u003e\n",
              "      \u003ctd\u003e...\u003c/td\u003e\n",
              "      \u003ctd\u003e...\u003c/td\u003e\n",
              "      \u003ctd\u003e...\u003c/td\u003e\n",
              "      \u003ctd\u003e...\u003c/td\u003e\n",
              "      \u003ctd\u003e...\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e26\u003c/th\u003e\n",
              "      \u003ctd\u003e28\u003c/td\u003e\n",
              "      \u003ctd\u003e151\u003c/td\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e2.6%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_standard_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e27\u003c/th\u003e\n",
              "      \u003ctd\u003e29\u003c/td\u003e\n",
              "      \u003ctd\u003e45\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_standard_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e20,731\u003c/td\u003e\n",
              "      \u003ctd\u003e11,973\u003c/td\u003e\n",
              "      \u003ctd\u003e57.8%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e20,731\u003c/td\u003e\n",
              "      \u003ctd\u003e11,973\u003c/td\u003e\n",
              "      \u003ctd\u003e57.8%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003e4\u003c/td\u003e\n",
              "      \u003ctd\u003e20,731\u003c/td\u003e\n",
              "      \u003ctd\u003e11,973\u003c/td\u003e\n",
              "      \u003ctd\u003e57.8%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003e5\u003c/td\u003e\n",
              "      \u003ctd\u003e20,729\u003c/td\u003e\n",
              "      \u003ctd\u003e11,971\u003c/td\u003e\n",
              "      \u003ctd\u003e57.8%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e19,819\u003c/td\u003e\n",
              "      \u003ctd\u003e11,081\u003c/td\u003e\n",
              "      \u003ctd\u003e55.9%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003e7\u003c/td\u003e\n",
              "      \u003ctd\u003e18,910\u003c/td\u003e\n",
              "      \u003ctd\u003e10,182\u003c/td\u003e\n",
              "      \u003ctd\u003e53.8%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003e8\u003c/td\u003e\n",
              "      \u003ctd\u003e18,008\u003c/td\u003e\n",
              "      \u003ctd\u003e9,295\u003c/td\u003e\n",
              "      \u003ctd\u003e51.6%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003e9\u003c/td\u003e\n",
              "      \u003ctd\u003e17,101\u003c/td\u003e\n",
              "      \u003ctd\u003e8,423\u003c/td\u003e\n",
              "      \u003ctd\u003e49.3%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003e10\u003c/td\u003e\n",
              "      \u003ctd\u003e16,191\u003c/td\u003e\n",
              "      \u003ctd\u003e7,567\u003c/td\u003e\n",
              "      \u003ctd\u003e46.7%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e9\u003c/th\u003e\n",
              "      \u003ctd\u003e11\u003c/td\u003e\n",
              "      \u003ctd\u003e15,278\u003c/td\u003e\n",
              "      \u003ctd\u003e6,733\u003c/td\u003e\n",
              "      \u003ctd\u003e44.1%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e10\u003c/th\u003e\n",
              "      \u003ctd\u003e12\u003c/td\u003e\n",
              "      \u003ctd\u003e14,342\u003c/td\u003e\n",
              "      \u003ctd\u003e5,873\u003c/td\u003e\n",
              "      \u003ctd\u003e40.9%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e11\u003c/th\u003e\n",
              "      \u003ctd\u003e13\u003c/td\u003e\n",
              "      \u003ctd\u003e13,422\u003c/td\u003e\n",
              "      \u003ctd\u003e5,066\u003c/td\u003e\n",
              "      \u003ctd\u003e37.7%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e12\u003c/th\u003e\n",
              "      \u003ctd\u003e14\u003c/td\u003e\n",
              "      \u003ctd\u003e12,456\u003c/td\u003e\n",
              "      \u003ctd\u003e4,221\u003c/td\u003e\n",
              "      \u003ctd\u003e33.9%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e13\u003c/th\u003e\n",
              "      \u003ctd\u003e15\u003c/td\u003e\n",
              "      \u003ctd\u003e11,466\u003c/td\u003e\n",
              "      \u003ctd\u003e3,379\u003c/td\u003e\n",
              "      \u003ctd\u003e29.5%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e14\u003c/th\u003e\n",
              "      \u003ctd\u003e16\u003c/td\u003e\n",
              "      \u003ctd\u003e10,472\u003c/td\u003e\n",
              "      \u003ctd\u003e2,629\u003c/td\u003e\n",
              "      \u003ctd\u003e25.1%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e15\u003c/th\u003e\n",
              "      \u003ctd\u003e17\u003c/td\u003e\n",
              "      \u003ctd\u003e9,454\u003c/td\u003e\n",
              "      \u003ctd\u003e1,913\u003c/td\u003e\n",
              "      \u003ctd\u003e20.2%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e16\u003c/th\u003e\n",
              "      \u003ctd\u003e18\u003c/td\u003e\n",
              "      \u003ctd\u003e8,443\u003c/td\u003e\n",
              "      \u003ctd\u003e1,323\u003c/td\u003e\n",
              "      \u003ctd\u003e15.7%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e17\u003c/th\u003e\n",
              "      \u003ctd\u003e19\u003c/td\u003e\n",
              "      \u003ctd\u003e7,397\u003c/td\u003e\n",
              "      \u003ctd\u003e847\u003c/td\u003e\n",
              "      \u003ctd\u003e11.5%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e18\u003c/th\u003e\n",
              "      \u003ctd\u003e20\u003c/td\u003e\n",
              "      \u003ctd\u003e6,434\u003c/td\u003e\n",
              "      \u003ctd\u003e527\u003c/td\u003e\n",
              "      \u003ctd\u003e8.2%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e19\u003c/th\u003e\n",
              "      \u003ctd\u003e21\u003c/td\u003e\n",
              "      \u003ctd\u003e5,500\u003c/td\u003e\n",
              "      \u003ctd\u003e318\u003c/td\u003e\n",
              "      \u003ctd\u003e5.8%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e20\u003c/th\u003e\n",
              "      \u003ctd\u003e22\u003c/td\u003e\n",
              "      \u003ctd\u003e4,545\u003c/td\u003e\n",
              "      \u003ctd\u003e181\u003c/td\u003e\n",
              "      \u003ctd\u003e4.0%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e21\u003c/th\u003e\n",
              "      \u003ctd\u003e23\u003c/td\u003e\n",
              "      \u003ctd\u003e3,551\u003c/td\u003e\n",
              "      \u003ctd\u003e71\u003c/td\u003e\n",
              "      \u003ctd\u003e2.0%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e22\u003c/th\u003e\n",
              "      \u003ctd\u003e24\u003c/td\u003e\n",
              "      \u003ctd\u003e2,511\u003c/td\u003e\n",
              "      \u003ctd\u003e22\u003c/td\u003e\n",
              "      \u003ctd\u003e0.9%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e23\u003c/th\u003e\n",
              "      \u003ctd\u003e25\u003c/td\u003e\n",
              "      \u003ctd\u003e1,713\u003c/td\u003e\n",
              "      \u003ctd\u003e6\u003c/td\u003e\n",
              "      \u003ctd\u003e0.4%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e24\u003c/th\u003e\n",
              "      \u003ctd\u003e26\u003c/td\u003e\n",
              "      \u003ctd\u003e1,120\u003c/td\u003e\n",
              "      \u003ctd\u003e3\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e25\u003c/th\u003e\n",
              "      \u003ctd\u003e27\u003c/td\u003e\n",
              "      \u003ctd\u003e735\u003c/td\u003e\n",
              "      \u003ctd\u003e2\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e26\u003c/th\u003e\n",
              "      \u003ctd\u003e28\u003c/td\u003e\n",
              "      \u003ctd\u003e398\u003c/td\u003e\n",
              "      \u003ctd\u003e1\u003c/td\u003e\n",
              "      \u003ctd\u003e0.3%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e27\u003c/th\u003e\n",
              "      \u003ctd\u003e29\u003c/td\u003e\n",
              "      \u003ctd\u003e133\u003c/td\u003e\n",
              "      \u003ctd\u003e0\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0%\u003c/td\u003e\n",
              "      \u003ctd\u003ernn_designed_plus_rand_train_walked\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003cp\u003e252 rows × 5 columns\u003c/p\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "    min_mutations # generated # viable % viable  \\\n",
              "0               2      19,999    1,483     7.4%   \n",
              "1               3      19,999    1,483     7.4%   \n",
              "2               4      19,999    1,483     7.4%   \n",
              "3               5      19,998    1,482     7.4%   \n",
              "4               6      19,375    1,265     6.5%   \n",
              "5               7      18,504    1,005     5.4%   \n",
              "6               8      17,613      881     5.0%   \n",
              "7               9      16,712      592     3.5%   \n",
              "8              10      15,829      570     3.6%   \n",
              "9              11      14,895      349     2.3%   \n",
              "10             12      14,002      230     1.6%   \n",
              "11             13      13,151      162     1.2%   \n",
              "12             14      12,104       84     0.7%   \n",
              "13             15      11,333       78     0.7%   \n",
              "14             16      10,368       70     0.7%   \n",
              "15             17       9,366       55     0.6%   \n",
              "16             18       8,417       50     0.6%   \n",
              "17             19       7,549       43     0.6%   \n",
              "18             20       6,570       32     0.5%   \n",
              "19             21       5,654       19     0.3%   \n",
              "20             22       4,800       15     0.3%   \n",
              "21             23       4,028       14     0.3%   \n",
              "22             24       2,790        9     0.3%   \n",
              "23             25       1,768        5     0.3%   \n",
              "24             26       1,211        4     0.3%   \n",
              "25             27         759        1     0.1%   \n",
              "26             28         436        1     0.2%   \n",
              "27             29         180        0     0.0%   \n",
              "0               2      20,456   19,211    93.9%   \n",
              "1               3      20,456   19,211    93.9%   \n",
              "..            ...         ...      ...      ...   \n",
              "26             28         151        4     2.6%   \n",
              "27             29          45        0     0.0%   \n",
              "0               2      20,731   11,973    57.8%   \n",
              "1               3      20,731   11,973    57.8%   \n",
              "2               4      20,731   11,973    57.8%   \n",
              "3               5      20,729   11,971    57.8%   \n",
              "4               6      19,819   11,081    55.9%   \n",
              "5               7      18,910   10,182    53.8%   \n",
              "6               8      18,008    9,295    51.6%   \n",
              "7               9      17,101    8,423    49.3%   \n",
              "8              10      16,191    7,567    46.7%   \n",
              "9              11      15,278    6,733    44.1%   \n",
              "10             12      14,342    5,873    40.9%   \n",
              "11             13      13,422    5,066    37.7%   \n",
              "12             14      12,456    4,221    33.9%   \n",
              "13             15      11,466    3,379    29.5%   \n",
              "14             16      10,472    2,629    25.1%   \n",
              "15             17       9,454    1,913    20.2%   \n",
              "16             18       8,443    1,323    15.7%   \n",
              "17             19       7,397      847    11.5%   \n",
              "18             20       6,434      527     8.2%   \n",
              "19             21       5,500      318     5.8%   \n",
              "20             22       4,545      181     4.0%   \n",
              "21             23       3,551       71     2.0%   \n",
              "22             24       2,511       22     0.9%   \n",
              "23             25       1,713        6     0.4%   \n",
              "24             26       1,120        3     0.3%   \n",
              "25             27         735        2     0.3%   \n",
              "26             28         398        1     0.3%   \n",
              "27             29         133        0     0.0%   \n",
              "\n",
              "                              partition  \n",
              "0    lr_rand_doubles_plus_single_walked  \n",
              "1    lr_rand_doubles_plus_single_walked  \n",
              "2    lr_rand_doubles_plus_single_walked  \n",
              "3    lr_rand_doubles_plus_single_walked  \n",
              "4    lr_rand_doubles_plus_single_walked  \n",
              "5    lr_rand_doubles_plus_single_walked  \n",
              "6    lr_rand_doubles_plus_single_walked  \n",
              "7    lr_rand_doubles_plus_single_walked  \n",
              "8    lr_rand_doubles_plus_single_walked  \n",
              "9    lr_rand_doubles_plus_single_walked  \n",
              "10   lr_rand_doubles_plus_single_walked  \n",
              "11   lr_rand_doubles_plus_single_walked  \n",
              "12   lr_rand_doubles_plus_single_walked  \n",
              "13   lr_rand_doubles_plus_single_walked  \n",
              "14   lr_rand_doubles_plus_single_walked  \n",
              "15   lr_rand_doubles_plus_single_walked  \n",
              "16   lr_rand_doubles_plus_single_walked  \n",
              "17   lr_rand_doubles_plus_single_walked  \n",
              "18   lr_rand_doubles_plus_single_walked  \n",
              "19   lr_rand_doubles_plus_single_walked  \n",
              "20   lr_rand_doubles_plus_single_walked  \n",
              "21   lr_rand_doubles_plus_single_walked  \n",
              "22   lr_rand_doubles_plus_single_walked  \n",
              "23   lr_rand_doubles_plus_single_walked  \n",
              "24   lr_rand_doubles_plus_single_walked  \n",
              "25   lr_rand_doubles_plus_single_walked  \n",
              "26   lr_rand_doubles_plus_single_walked  \n",
              "27   lr_rand_doubles_plus_single_walked  \n",
              "0                    lr_standard_walked  \n",
              "1                    lr_standard_walked  \n",
              "..                                  ...  \n",
              "26                  rnn_standard_walked  \n",
              "27                  rnn_standard_walked  \n",
              "0   rnn_designed_plus_rand_train_walked  \n",
              "1   rnn_designed_plus_rand_train_walked  \n",
              "2   rnn_designed_plus_rand_train_walked  \n",
              "3   rnn_designed_plus_rand_train_walked  \n",
              "4   rnn_designed_plus_rand_train_walked  \n",
              "5   rnn_designed_plus_rand_train_walked  \n",
              "6   rnn_designed_plus_rand_train_walked  \n",
              "7   rnn_designed_plus_rand_train_walked  \n",
              "8   rnn_designed_plus_rand_train_walked  \n",
              "9   rnn_designed_plus_rand_train_walked  \n",
              "10  rnn_designed_plus_rand_train_walked  \n",
              "11  rnn_designed_plus_rand_train_walked  \n",
              "12  rnn_designed_plus_rand_train_walked  \n",
              "13  rnn_designed_plus_rand_train_walked  \n",
              "14  rnn_designed_plus_rand_train_walked  \n",
              "15  rnn_designed_plus_rand_train_walked  \n",
              "16  rnn_designed_plus_rand_train_walked  \n",
              "17  rnn_designed_plus_rand_train_walked  \n",
              "18  rnn_designed_plus_rand_train_walked  \n",
              "19  rnn_designed_plus_rand_train_walked  \n",
              "20  rnn_designed_plus_rand_train_walked  \n",
              "21  rnn_designed_plus_rand_train_walked  \n",
              "22  rnn_designed_plus_rand_train_walked  \n",
              "23  rnn_designed_plus_rand_train_walked  \n",
              "24  rnn_designed_plus_rand_train_walked  \n",
              "25  rnn_designed_plus_rand_train_walked  \n",
              "26  rnn_designed_plus_rand_train_walked  \n",
              "27  rnn_designed_plus_rand_train_walked  \n",
              "\n",
              "[252 rows x 5 columns]"
            ]
          },
          "execution_count": 12,
          "metadata": {
            "tags": []
          },
          "output_type": "execute_result"
        }
      ],
      "source": [
        "sub_tables = []\n",
        "for partition in ml_designed_partitions:\n",
        "  partition_perf = performance_by_wt_distance(\n",
        "      df, \n",
        "      [partition],\n",
        "  )  \n",
        "  partition_perf['partition'] = partition\n",
        "  sub_tables.append(partition_perf)\n",
        "stats_table = pandas.concat(sub_tables)\n",
        "stats_table"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Rqi38mWOabox"
      },
      "source": [
        "## Figure 3"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ahvOHfrTNZbl"
      },
      "source": [
        "### Perplexity of residues by position per model"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "tryrLV67ToIT"
      },
      "outputs": [],
      "source": [
        "def get_mutation_count_matrix(\n",
        "    sequences, encoder=ONEHOT_FIXEDLEN_MUTATION_ENCODER):\n",
        "  mutations = None\n",
        "  for seq in sequences:\n",
        "    seq_mutations = encoder.encode(seq)\n",
        "    if mutations is None:\n",
        "      mutations = seq_mutations\n",
        "    else:\n",
        "      mutations += seq_mutations\n",
        "  subs = mutations[1:, 0, :]\n",
        "  inserts = mutations[1:, 1, :]\n",
        "  return subs, inserts\n",
        "\n",
        "\n",
        "def get_perplexity(mutation_count_matrix, replace_nan=True):\n",
        "  \"\"\"\n",
        "  Args:\n",
        "    mutation_count_matrix: (n_positions, 20) array containing #mutations of each\n",
        "      residue type for the set of positions\n",
        "  Returns:\n",
        "    perplexity per position (n_positions,) array with max value of 20\n",
        "    (a uniform distribution for a given position would have perplexity of 20\n",
        "    b/c complete confusion across 20 options).\n",
        "  \"\"\"\n",
        "  counts_matrix = mutation_count_matrix.T\n",
        "  perplexity = 2**scipy.stats.entropy(counts_matrix, base=2)\n",
        "  if replace_nan:\n",
        "    perplexity[numpy.isnan(perplexity)] = 0  # For plotting purposes\n",
        "  return perplexity\n",
        "\n",
        "\n",
        "def plot_mutation_perplexity(\n",
        "    mutation_count_matrix, \n",
        "    start_resnum=R1_TILE21_WT_START_RESNUM,\n",
        "    end_resnum=R1_TILE21_WT_END_RESNUM,  # inclusive      \n",
        "    label=None, \n",
        "    linewidth=1,\n",
        "    ):\n",
        "  \n",
        "  perplexity = get_perplexity(mutation_count_matrix)\n",
        "  resnums = range(start_resnum, end_resnum+1)\n",
        "  # Trick to make the final step in plot be full-width: add extra point\n",
        "  perplexity = list(perplexity) + [0]\n",
        "  resnums.append(end_resnum+2)  # TODO: simplify\n",
        "  pyplot.step(\n",
        "      resnums, \n",
        "      perplexity,\n",
        "      label=label,\n",
        "      where='post', \n",
        "      linewidth=linewidth)\n",
        "\n",
        "def plot_mutation_perplexity_multi(\n",
        "    df,\n",
        "    partitions, \n",
        "    start_resnum=R1_TILE21_WT_START_RESNUM,\n",
        "    end_resnum=R1_TILE21_WT_END_RESNUM,  # inclusive      \n",
        "    subs=True,\n",
        "    figsize=(12, 3),\n",
        "    tick_size=10,\n",
        "    anno_fontsize=10,\n",
        "    axis_label_size=10,\n",
        "    ):\n",
        "  fig, ax=pyplot.subplots(figsize=figsize)\n",
        "  \n",
        "  for p in partitions:\n",
        "    sub_counts, insert_counts = get_mutation_count_matrix(\n",
        "        df[\n",
        "            (df.partition == p) \n",
        "            \u0026 (df.is_viable)\n",
        "            \u0026 (df.num_edits \u003e= 12)\n",
        "        ].sequence)\n",
        "\n",
        "    linewidth = 1\n",
        "    if subs:\n",
        "      plot_mutation_perplexity(\n",
        "          sub_counts, \n",
        "          start_resnum=start_resnum,\n",
        "          end_resnum=end_resnum,\n",
        "          label=p, \n",
        "          # color=color,\n",
        "          linewidth=linewidth)\n",
        "    else:\n",
        "      plot_mutation_perplexity(\n",
        "          insert_counts, \n",
        "          start_resnum=start_resnum,\n",
        "          end_resnum=end_resnum,\n",
        "          label=p, \n",
        "          # color=color,\n",
        "          linewidth=linewidth)\n",
        "\n",
        "  pyplot.ylim(0, 15)\n",
        "  pyplot.yticks([0, 5, 10, 15])\n",
        "  for y_thresh in [5, 10, 15, 20]:\n",
        "    pyplot.axhline(\n",
        "        y=y_thresh, color='black', linestyle='--', alpha=.7, linewidth=.25)    \n",
        "\n",
        "  ax.spines['right'].set_visible(True)\n",
        "  ax.spines['right'].set_linewidth(0.5)  \n",
        "  ax.tick_params(axis='both', labelsize=tick_size)\n",
        "  pyplot.legend(loc='upper left')\n",
        "\n",
        "\n",
        "seaborn.set_style('white')\n",
        "for p in [\n",
        "          ml_designed_partitions_doubles, \n",
        "          ml_designed_partitions_standard,\n",
        "          ml_designed_partitions_designed,\n",
        "          ]:\n",
        "\n",
        "  plot_mutation_perplexity_multi(df, p, subs=True)\n",
        "  pyplot.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "8xYV6gVKNHTU"
      },
      "source": [
        "### Mutation distribution heatmaps by model"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "YLeId5SANLcE"
      },
      "outputs": [],
      "source": [
        "def show_mutation_heatmap_side_by_side_horizontal(\n",
        "    df,\n",
        "    encoder=ONEHOT_FIXEDLEN_MUTATION_ENCODER,\n",
        "    log=True,\n",
        "    normalize=False,\n",
        "    colorbar_num_quantiles=None,\n",
        "    wt_seq=R1_TILE21_WT_SEQ,\n",
        "    figsize=(2.5, 1),\n",
        "    cmap_name='viridis',\n",
        "    color_rgb=None,\n",
        "    scale_color_rgb=False, # should the rgb values be divided by 255\n",
        "    wt_point_size=15,\n",
        "    cbar=True,\n",
        "    vmax=None,\n",
        "    subs_only=False,\n",
        "    dpi=300,\n",
        "    linewidth=1,\n",
        "    threshold_linewidth=.25,\n",
        "    scale=4):\n",
        "\n",
        "  tick_size = 6\n",
        "  axis_label_size = 8\n",
        "  anno_fontsize = tick_size\n",
        "  figsize = tuple(x*scale for x in figsize)\n",
        "  pyplot.figure(figsize=figsize, dpi=dpi)  \n",
        "  ax = pyplot.gca()\n",
        "\n",
        "  assert all(numpy.array(encoder._residue_encoder._alphabet) == numpy.array(RESIDUES))\n",
        "  \n",
        "  mutations = None\n",
        "  for seq in df['mutation_sequence']:\n",
        "    seq_mutations = encoder.encode(seq)\n",
        "    if mutations is None:\n",
        "      mutations = seq_mutations\n",
        "    else:\n",
        "      mutations += seq_mutations\n",
        "  mutations = mutations[1:, :, :]  # Remove the prefix position\n",
        "  print 'mutation heatmap range \u003c%d, %d\u003e' % (mutations.min(), mutations.max())\n",
        "\n",
        "  residue_to_index = {\n",
        "      v: k for k,v in enumerate(encoder._residue_encoder._alphabet)\n",
        "  }\n",
        "  physchem_residue_order = [\n",
        "      residue_to_index[aa] for aa in RESIDUES_PHYSCHEM_ORDER\n",
        "  ]      \n",
        "  residue_order = physchem_residue_order\n",
        "  physchem_residue_labels = RESIDUES_PHYSCHEM_ORDER\n",
        "  tile21_resnums = [\n",
        "    R1_TILE21_WT_START_RESNUM + i \n",
        "    for i in range(len(wt_seq))\n",
        "  ]\n",
        "\n",
        "  pyplot.ylabel('AAV2 residue number')\n",
        "  \n",
        "  subs = mutations[:, 0, :]\n",
        "  inserts = mutations[:, 1, :]\n",
        "  mutations = numpy.concatenate([\n",
        "      subs,  # subs only\n",
        "      inserts,  # ins only   \n",
        "  ], axis=1)\n",
        "\n",
        "  if normalize:\n",
        "    mutations /= len(df)  # normalize by number of sequences\n",
        "  if log:\n",
        "    mutations = numpy.log10(1 + mutations)\n",
        "\n",
        "  # Rotate the heatmap horizontally via transpose\n",
        "  mutations = mutations.T\n",
        "  subs_and_ins_residue_order = (\n",
        "      residue_order \n",
        "      + list(len(residue_order) + numpy.array(residue_order))  # residues but offset by 20\n",
        "  )\n",
        "\n",
        "  wt_mutations = encoder.encode(wt_seq)\n",
        "  wt_mutations = wt_mutations[1:, : :]  # drop prefix slot\n",
        "  wt_subs = wt_mutations[:, 0, :]\n",
        "  wt_ins = wt_mutations[:, 1, :]\n",
        "  wt_mutations = numpy.concatenate([wt_subs, wt_ins], axis=1)\n",
        "  wt_mutations = wt_mutations.T\n",
        "  wt_mutations = wt_mutations[subs_and_ins_residue_order, :]\n",
        "  wt_residue_indices, wt_position_indices = numpy.where(wt_mutations \u003e 0)\n",
        "  marker_offset_epsilon = 0.1\n",
        "  marker_offset_residue_indices = 0.5 - marker_offset_epsilon\n",
        "  marker_offset_position_indices = 0.5\n",
        "  wt_position_indices = wt_position_indices + marker_offset_position_indices\n",
        "  wt_residue_indices = wt_residue_indices + marker_offset_residue_indices\n",
        "  \n",
        "  cmap = pyplot.cm.get_cmap(cmap_name, colorbar_num_quantiles)\n",
        "  if color_rgb is not None:\n",
        "    if scale_color_rgb:\n",
        "      color_rgb = [c/255. for c in color_rgb]\n",
        "    cmap = seaborn.light_palette(color_rgb, n_colors=100, input=\"rgb\")\n",
        "  ax = seaborn.heatmap(\n",
        "      mutations[subs_and_ins_residue_order, :], \n",
        "      cmap=cmap,\n",
        "      xticklabels=tile21_resnums,\n",
        "      yticklabels=physchem_residue_labels + physchem_residue_labels,\n",
        "      robust=True,\n",
        "      cbar=cbar,\n",
        "      vmax=vmax if not log else numpy.log10(vmax),\n",
        "  )\n",
        "\n",
        "  if cbar:\n",
        "    cbar = ax.collections[0].colorbar\n",
        "    if log:\n",
        "      tick_values = [1, 10, 100, 1000]\n",
        "      possible_log_ticks = [numpy.log10(t) for t in tick_values]\n",
        "      possible_log_tick_labels = [str(t) for t in tick_values]\n",
        "      log_ticks = []\n",
        "      log_tick_labels = []\n",
        "      for t, l in zip(possible_log_ticks, possible_log_tick_labels):\n",
        "        if t \u003c= numpy.log10(vmax):\n",
        "          log_ticks.append(t)\n",
        "          log_tick_labels.append(l)\n",
        "      cbar.set_ticks(log_ticks)\n",
        "      log_tick_labels[-1] = '\u003e' + log_tick_labels[-1]\n",
        "      cbar.set_ticklabels(log_tick_labels)\n",
        "\n",
        "  ax.scatter(\n",
        "      wt_position_indices - .1,  # shift the point more to the center of the square\n",
        "      wt_residue_indices, \n",
        "      color='white', \n",
        "      s=wt_point_size,\n",
        "      )\n",
        "  pyplot.axhline(y=20, color='white', linewidth=1)  # horizontal separator between subs and inserts\n",
        "\n",
        "\n",
        "\n",
        "################################################################################\n",
        "for name in ml_designed_partitions:\n",
        "    data = df[\n",
        "              (df.partition == name) \n",
        "              \u0026 (df.is_viable) \n",
        "              \u0026 (df.num_edits \u003e= 12)]\n",
        "    show_mutation_heatmap_side_by_side_horizontal(\n",
        "        data, \n",
        "        normalize=False, \n",
        "        log=True,\n",
        "        colorbar_num_quantiles=30,\n",
        "        scale=8,\n",
        "        cmap_name='viridis',\n",
        "        cbar=True,\n",
        "        vmax=1000,\n",
        "    )\n",
        "    pyplot.show()\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "zZiR35p3ecoM"
      },
      "outputs": [],
      "source": [
        ""
      ]
    }
  ],
  "metadata": {
    "colab": {
      "collapsed_sections": [],
      "last_runtime": {
        "build_target": "//learning/vizier/service/colab:notebook",
        "kind": "private"
      },
      "name": "200418 aav paper figure 3 and SI tables.ipynb",
      "provenance": [
        {
          "file_id": "1sOHcNmH2jH1PTJWTGGBLX4b48h8ixKig",
          "timestamp": 1587162862489
        },
        {
          "file_id": "1vDcCjZaGpcfmkSf-joB2nPFwrJ7iEpQr",
          "timestamp": 1567784332125
        },
        {
          "file_id": "1UQZk5hTJTiQTz-9aCdR3fJhCsxPtimrs",
          "timestamp": 1561502730113
        },
        {
          "file_id": "16BVjlr7HFcjXtnVKFNyIDP8fiHRrDdf0",
          "timestamp": 1559923092971
        },
        {
          "file_id": "18k6SHzEVdS2JnNeancJUwqK-o6mvURXE",
          "timestamp": 1555809778465
        },
        {
          "file_id": "12hTZC_DQ9NBXsqKMpRFhIcWuKis1bh-J",
          "timestamp": 1549047641664
        },
        {
          "file_id": "1OgULW5iWdsdSbeF0VRaczJyuRqTpFdk-",
          "timestamp": 1548806910136
        }
      ]
    },
    "kernelspec": {
      "display_name": "Python 2",
      "language": "python",
      "name": "python2"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 2
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython2",
      "version": "2.7.16"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
